mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-28 17:46:16 +01:00
fix: wait for event.log to finish before killing process
This commit is contained in:
@@ -53,19 +53,18 @@ SocketAdmin.before = async function (socket, method) {
|
|||||||
throw new Error('[[error:no-privileges]]');
|
throw new Error('[[error:no-privileges]]');
|
||||||
};
|
};
|
||||||
|
|
||||||
SocketAdmin.restart = function (socket, data, callback) {
|
SocketAdmin.restart = async function (socket) {
|
||||||
logRestart(socket);
|
await logRestart(socket);
|
||||||
meta.restart();
|
meta.restart();
|
||||||
callback();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function logRestart(socket) {
|
async function logRestart(socket) {
|
||||||
events.log({
|
await events.log({
|
||||||
type: 'restart',
|
type: 'restart',
|
||||||
uid: socket.uid,
|
uid: socket.uid,
|
||||||
ip: socket.ip,
|
ip: socket.ip,
|
||||||
});
|
});
|
||||||
db.setObject('lastrestart', {
|
await db.setObject('lastrestart', {
|
||||||
uid: socket.uid,
|
uid: socket.uid,
|
||||||
ip: socket.ip,
|
ip: socket.ip,
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
@@ -80,7 +79,7 @@ SocketAdmin.reload = async function (socket) {
|
|||||||
ip: socket.ip,
|
ip: socket.ip,
|
||||||
});
|
});
|
||||||
|
|
||||||
logRestart(socket);
|
await logRestart(socket);
|
||||||
meta.restart();
|
meta.restart();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user