mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
server: Refactor stop()
to avoid no-async-promise-executor lint error
Also log when Etherpad has stopped.
This commit is contained in:
parent
d339f2a671
commit
725023fe58
1 changed files with 9 additions and 6 deletions
|
@ -106,12 +106,15 @@ exports.stop = async () => {
|
||||||
if (stopped) return;
|
if (stopped) return;
|
||||||
stopped = true;
|
stopped = true;
|
||||||
console.log('Stopping Etherpad...');
|
console.log('Stopping Etherpad...');
|
||||||
await new Promise(async (resolve, reject) => {
|
let timeout = null;
|
||||||
const id = setTimeout(() => reject(new Error('Timed out waiting for shutdown tasks')), 3000);
|
await Promise.race([
|
||||||
await hooks.aCallAll('shutdown');
|
hooks.aCallAll('shutdown'),
|
||||||
clearTimeout(id);
|
new Promise((resolve, reject) => {
|
||||||
resolve();
|
timeout = setTimeout(() => reject(new Error('Timed out waiting for shutdown tasks')), 3000);
|
||||||
});
|
}),
|
||||||
|
]);
|
||||||
|
clearTimeout(timeout);
|
||||||
|
console.log('Etherpad stopped');
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.exit = async (err) => {
|
exports.exit = async (err) => {
|
||||||
|
|
Loading…
Reference in a new issue