mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-26 17:46:06 +00:00
api/cookie: do not recreate interval if it already exists
This commit is contained in:
parent
a4cb6ada79
commit
fbacb94495
|
@ -27,6 +27,7 @@ function writeChanges(cookiePath) {
|
|||
console.warn(`${Yellow('[!]')} failed writing updated cookies to storage`);
|
||||
console.warn(e);
|
||||
clearInterval(intervalId);
|
||||
intervalId = null;
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -47,7 +48,9 @@ const setupMain = async (cookiePath) => {
|
|||
delete cookies[serviceName];
|
||||
}
|
||||
|
||||
intervalId = setInterval(() => writeChanges(cookiePath), WRITE_INTERVAL);
|
||||
if (!intervalId) {
|
||||
intervalId = setInterval(() => writeChanges(cookiePath), WRITE_INTERVAL);
|
||||
}
|
||||
|
||||
cluster.broadcast({ cookies });
|
||||
|
||||
|
|
Loading…
Reference in a new issue