Moved queue start into UrlServices init block

refs https://github.com/TryGhost/Toolbox/issues/125

- The "fetchResources" is only used from one place and does way to many things at once:
- Fetches resources from the DB-
- Hooks up event listeners
- Starts the queue

- These are three different things, and should be three different methods ideally
This commit is contained in:
Naz 2021-11-11 17:09:31 +04:00
parent ef8852c5b6
commit 46c3b53979
2 changed files with 7 additions and 9 deletions

View File

@ -97,15 +97,7 @@ class Resources {
});
});
Promise.all(ops)
.then(() => {
// CASE: all resources are fetched, start the queue
this.queue.start({
event: 'init',
tolerance: 100,
requiredSubscriberCount: 1
});
});
return Promise.all(ops);
}
/**

View File

@ -288,6 +288,12 @@ class UrlService {
*/
init() {
this.resources.fetchResources();
// CASE: all resources are fetched, start the queue
this.queue.start({
event: 'init',
tolerance: 100,
requiredSubscriberCount: 1
});
}
/**