mirror of
https://github.com/wukko/cobalt.git
synced 2025-05-14 12:27:07 +02: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(`${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…
x
Reference in New Issue
Block a user