mirror of
https://github.com/imputnet/cobalt.git
synced 2025-01-14 02:45:15 +00:00
api/cookie: split initial load into separate function
This commit is contained in:
parent
20074a5091
commit
a4cb6ada79
|
@ -62,13 +62,19 @@ const setupWorker = async () => {
|
|||
cookies = (await cluster.waitFor('cookies')).cookies;
|
||||
}
|
||||
|
||||
export const setup = async (cookiePath) => {
|
||||
export const loadFromFile = async (path) => {
|
||||
if (cluster.isPrimary) {
|
||||
await setupMain(cookiePath);
|
||||
await setupMain(path);
|
||||
} else if (cluster.isWorker) {
|
||||
await setupWorker();
|
||||
}
|
||||
|
||||
dirty = false;
|
||||
}
|
||||
|
||||
export const setup = async (path) => {
|
||||
await loadFromFile(path);
|
||||
|
||||
if (isCluster) {
|
||||
const messageHandler = (message) => {
|
||||
if ('cookieUpdate' in message) {
|
||||
|
|
Loading…
Reference in a new issue