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