From 50929fe7f7657de8bd8440f6653bdb27d894e616 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 9 Feb 2021 16:46:37 -0500 Subject: [PATCH] express: Call expressConfigure, expressCreateServer hooks asynchronously --- CHANGELOG.md | 3 ++- src/node/hooks/express.js | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78b933406..cac510eeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/node/hooks/express.js b/src/node/hooks/express.js index b3d4f34e4..9b70c6c55 100644 --- a/src/node/hooks/express.js +++ b/src/node/hooks/express.js @@ -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); };