mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-28 10:19:50 +01:00
refactor: server.destroy
This commit is contained in:
@@ -147,6 +147,6 @@ async function shutdown(code) {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
winston.error(err.stack);
|
winston.error(err.stack);
|
||||||
|
|
||||||
return process.exit(code || 0);
|
process.exit(code || 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,11 +69,16 @@ server.on('connection', (conn) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.destroy = function (callback) {
|
exports.destroy = function () {
|
||||||
server.close(callback);
|
return new Promise((resolve, reject) => {
|
||||||
for (const connection of Object.values(connections)) {
|
server.close((err) => {
|
||||||
connection.destroy();
|
if (err) reject(err);
|
||||||
}
|
else resolve();
|
||||||
|
});
|
||||||
|
for (const connection of Object.values(connections)) {
|
||||||
|
connection.destroy();
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.getConnectionCount = function () {
|
exports.getConnectionCount = function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user