mirror of
https://github.com/imputnet/cobalt.git
synced 2025-01-14 10:55: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;
|
cookies = (await cluster.waitFor('cookies')).cookies;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const setup = async (cookiePath) => {
|
export const loadFromFile = async (path) => {
|
||||||
if (cluster.isPrimary) {
|
if (cluster.isPrimary) {
|
||||||
await setupMain(cookiePath);
|
await setupMain(path);
|
||||||
} else if (cluster.isWorker) {
|
} else if (cluster.isWorker) {
|
||||||
await setupWorker();
|
await setupWorker();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const setup = async (path) => {
|
||||||
|
await loadFromFile(path);
|
||||||
|
|
||||||
if (isCluster) {
|
if (isCluster) {
|
||||||
const messageHandler = (message) => {
|
const messageHandler = (message) => {
|
||||||
if ('cookieUpdate' in message) {
|
if ('cookieUpdate' in message) {
|
||||||
|
|
Loading…
Reference in a new issue