express: Call expressConfigure, expressCreateServer hooks asynchronously

pull/4765/head
Richard Hansen 2021-02-09 16:46:37 -05:00 committed by John McLear
parent 8919f63c98
commit 50929fe7f7
2 changed files with 6 additions and 4 deletions

View File

@ -33,7 +33,8 @@
* `callFirst()` and `aCallFirst()` now support the same wide range of hook
function behaviors that `callAll()`, `aCallAll()`, and `callAllSerial()`
support. Also, they now warn when a hook function misbehaves.
* The `padCopy` and `padRemove` hooks now support asynchronous hook functions.
* The following server-side hooks now support asynchronous hook functions:
`expressConfigure`, `expressCreateServer`, `padCopy`, `padRemove`
* Backend tests for plugins can now use the
[`ep_etherpad-lite/tests/backend/common`](src/tests/backend/common.js)
module to start the server and simplify API access.

View File

@ -182,9 +182,10 @@ exports.restartServer = async () => {
app.use(cookieParser(settings.sessionKey, {}));
hooks.callAll('expressConfigure', {app});
hooks.callAll('expressCreateServer', {app, server: exports.server});
await Promise.all([
hooks.aCallAll('expressConfigure', {app}),
hooks.aCallAll('expressCreateServer', {app, server: exports.server}),
]);
await util.promisify(exports.server.listen).bind(exports.server)(settings.port, settings.ip);
};