mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
Moved path_exists and promises to es6
This commit is contained in:
parent
6ed711a4d8
commit
4ff00e278a
8 changed files with 59 additions and 31 deletions
|
@ -74,7 +74,7 @@ const express = require('./hooks/express');
|
|||
const hooks = require('../static/js/pluginfw/hooks');
|
||||
const pluginDefs = require('../static/js/pluginfw/plugin_defs');
|
||||
const plugins = require('../static/js/pluginfw/plugins');
|
||||
const {Gate} = require('./utils/promises');
|
||||
import {Gate} from './utils/promises';
|
||||
const stats = require('./stats')
|
||||
|
||||
const logger = log4js.getLogger('server');
|
||||
|
@ -100,7 +100,7 @@ const removeSignalListener = (signal: NodeJS.Signals, listener: NodeJS.SignalsLi
|
|||
};
|
||||
|
||||
|
||||
let startDoneGate: { resolve: () => void; }
|
||||
let startDoneGate: Gate<unknown>
|
||||
exports.start = async () => {
|
||||
switch (state) {
|
||||
case State.INITIAL:
|
||||
|
@ -181,12 +181,14 @@ exports.start = async () => {
|
|||
} catch (err) {
|
||||
logger.error('Error occurred while starting Etherpad');
|
||||
state = State.STATE_TRANSITION_FAILED;
|
||||
// @ts-ignore
|
||||
startDoneGate.resolve();
|
||||
return await exports.exit(err);
|
||||
}
|
||||
|
||||
logger.info('Etherpad is running');
|
||||
state = State.RUNNING;
|
||||
// @ts-ignore
|
||||
startDoneGate.resolve();
|
||||
|
||||
// Return the HTTP server to make it easier to write tests.
|
||||
|
@ -228,11 +230,13 @@ exports.stop = async () => {
|
|||
} catch (err) {
|
||||
logger.error('Error occurred while stopping Etherpad');
|
||||
state = State.STATE_TRANSITION_FAILED;
|
||||
// @ts-ignore
|
||||
stopDoneGate.resolve();
|
||||
return await exports.exit(err);
|
||||
}
|
||||
logger.info('Etherpad stopped');
|
||||
state = State.STOPPED;
|
||||
// @ts-ignore
|
||||
stopDoneGate.resolve();
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue