mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
PadMessageHandler: Switch from nodeify to util.callbackify
This commit is contained in:
parent
abf4eeeb17
commit
5c1177a3d9
3 changed files with 9 additions and 6 deletions
|
@ -37,8 +37,8 @@ const hooks = require('../../static/js/pluginfw/hooks.js');
|
||||||
const channels = require('channels');
|
const channels = require('channels');
|
||||||
const stats = require('../stats');
|
const stats = require('../stats');
|
||||||
const assert = require('assert').strict;
|
const assert = require('assert').strict;
|
||||||
const nodeify = require('nodeify');
|
|
||||||
const {RateLimiterMemory} = require('rate-limiter-flexible');
|
const {RateLimiterMemory} = require('rate-limiter-flexible');
|
||||||
|
const util = require('util');
|
||||||
const webaccess = require('../hooks/express/webaccess');
|
const webaccess = require('../hooks/express/webaccess');
|
||||||
|
|
||||||
let rateLimiter;
|
let rateLimiter;
|
||||||
|
@ -87,9 +87,8 @@ stats.gauge('activePads', () => {
|
||||||
/**
|
/**
|
||||||
* A changeset queue per pad that is processed by handleUserChanges()
|
* A changeset queue per pad that is processed by handleUserChanges()
|
||||||
*/
|
*/
|
||||||
const padChannels = new channels.channels(
|
const padChannels =
|
||||||
({socket, message}, callback) => nodeify(handleUserChanges(socket, message), callback)
|
new channels.channels(({socket, message}, cb) => handleUserChangesCb(socket, message, cb));
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This Method is called by server.js to tell the message handler on which socket it should send
|
* This Method is called by server.js to tell the message handler on which socket it should send
|
||||||
|
@ -691,6 +690,7 @@ const handleUserChanges = async (socket, message) => {
|
||||||
|
|
||||||
stopWatch.end();
|
stopWatch.end();
|
||||||
};
|
};
|
||||||
|
const handleUserChangesCb = util.callbackify(handleUserChanges);
|
||||||
|
|
||||||
exports.updatePadClients = async (pad) => {
|
exports.updatePadClients = async (pad) => {
|
||||||
// skip this if no-one is on this pad
|
// skip this if no-one is on this pad
|
||||||
|
|
5
src/package-lock.json
generated
5
src/package-lock.json
generated
|
@ -3054,7 +3054,8 @@
|
||||||
"is-promise": {
|
"is-promise": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-1.0.1.tgz",
|
||||||
"integrity": "sha1-MVc3YcBX4zwukaq56W2gjO++duU="
|
"integrity": "sha1-MVc3YcBX4zwukaq56W2gjO++duU=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"is-redirect": {
|
"is-redirect": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
@ -4012,6 +4013,7 @@
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/nodeify/-/nodeify-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/nodeify/-/nodeify-1.0.1.tgz",
|
||||||
"integrity": "sha1-ZKtpp7268DzhB7TwM1yHwLnpGx0=",
|
"integrity": "sha1-ZKtpp7268DzhB7TwM1yHwLnpGx0=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"is-promise": "~1.0.0",
|
"is-promise": "~1.0.0",
|
||||||
"promise": "~1.3.0"
|
"promise": "~1.3.0"
|
||||||
|
@ -7509,6 +7511,7 @@
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/promise/-/promise-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/promise/-/promise-1.3.0.tgz",
|
||||||
"integrity": "sha1-5cyaTIJ45GZP/twBx9qEhCsEAXU=",
|
"integrity": "sha1-5cyaTIJ45GZP/twBx9qEhCsEAXU=",
|
||||||
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"is-promise": "~1"
|
"is-promise": "~1"
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,6 @@
|
||||||
"log4js": "0.6.38",
|
"log4js": "0.6.38",
|
||||||
"measured-core": "^2.0.0",
|
"measured-core": "^2.0.0",
|
||||||
"mime-types": "^2.1.33",
|
"mime-types": "^2.1.33",
|
||||||
"nodeify": "1.0.1",
|
|
||||||
"npm": "^6.14.15",
|
"npm": "^6.14.15",
|
||||||
"openapi-backend": "^4.2.0",
|
"openapi-backend": "^4.2.0",
|
||||||
"proxy-addr": "^2.0.7",
|
"proxy-addr": "^2.0.7",
|
||||||
|
@ -90,6 +89,7 @@
|
||||||
"etherpad-cli-client": "^0.1.12",
|
"etherpad-cli-client": "^0.1.12",
|
||||||
"mocha": "^9.1.1",
|
"mocha": "^9.1.1",
|
||||||
"mocha-froth": "^0.2.10",
|
"mocha-froth": "^0.2.10",
|
||||||
|
"nodeify": "^1.0.1",
|
||||||
"openapi-schema-validation": "^0.4.2",
|
"openapi-schema-validation": "^0.4.2",
|
||||||
"selenium-webdriver": "^4.0.0-rc-1",
|
"selenium-webdriver": "^4.0.0-rc-1",
|
||||||
"set-cookie-parser": "^2.4.8",
|
"set-cookie-parser": "^2.4.8",
|
||||||
|
|
Loading…
Reference in a new issue