From 5d30e0b1b2a3af8df1d6ee0296f0462de1af3dd1 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 29 Oct 2021 22:52:17 -0400 Subject: [PATCH] PadMessageHandler: Run the `userLeave` hook asynchronously --- doc/api/hooks_server-side.md | 2 +- src/node/handler/PadMessageHandler.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md index 1a3f80833..25c02aae5 100644 --- a/doc/api/hooks_server-side.md +++ b/doc/api/hooks_server-side.md @@ -834,7 +834,7 @@ Context properties: Example: ```javascript -exports.userLeave = (hookName, {author, padId}) => { +exports.userLeave = async (hookName, {author, padId}) => { console.log(`${author} left pad ${padId}`); }; ``` diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 2385a825e..d7c4157b2 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -148,7 +148,7 @@ exports.handleDisconnect = async (socket) => { }, }, }); - hooks.callAll('userLeave', session); + await hooks.aCallAll('userLeave', session); }; /**