Move X-Rank updaters into a separate, low-priority schedule

This commit is contained in:
Matt Isenhower
2023-02-12 09:13:26 -08:00
parent 8b2cd71e5f
commit 3ffc71e5b1
4 changed files with 38 additions and 11 deletions

View File

@@ -16,21 +16,43 @@ function updaters() {
tokens.EU && new FestivalUpdater('EU'),
tokens.JP && new FestivalUpdater('JP'),
tokens.AP && new FestivalUpdater('AP'),
new XRankUpdater('Tentatek', 'ATLANTIC'),
new XRankUpdater('Takoroka', 'PACIFIC'),
].filter(u => u);
}
export async function updateAll() {
console.info('Running all updaters...');
function lowPriorityUpdaters() {
return [
new XRankUpdater('Tentatek', 'ATLANTIC'),
new XRankUpdater('Takoroka', 'PACIFIC'),
];
}
for (let updater of updaters()) {
async function run(updaters) {
for (let updater of updaters) {
try {
await updater.updateIfNeeded();
} catch (e) {
console.error(e);
}
}
console.info('Done running updaters');
}
export async function updateAll() {
console.info('Running all updaters...');
await run([
...updaters(),
...lowPriorityUpdaters(),
]);
console.info('Done running all updaters');
}
export async function updatePrimary() {
console.info('Running primary updaters...');
await run(updaters());
console.info('Done running primary updaters');
}
export async function updateLowPriority() {
console.info('Running low-priority updaters...');
await run(lowPriorityUpdaters());
console.info('Done running low-priority updaters');
}