mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-04-25 17:14:57 +02:00
fix(consumer-prices): fold validate into aggregate job, remove separate cron step (#2062)
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
"start": "node dist/api/server.js",
|
||||
"dev": "tsx watch src/api/server.ts",
|
||||
"jobs:scrape": "tsx src/jobs/scrape.ts",
|
||||
"jobs:validate": "tsx src/jobs/validate.ts",
|
||||
"jobs:aggregate": "tsx src/jobs/aggregate.ts",
|
||||
"jobs:publish": "tsx src/jobs/publish.ts",
|
||||
"migrate": "tsx src/db/migrate.ts",
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
import { query, closePool } from '../db/client.js';
|
||||
import { loadAllBasketConfigs } from '../config/loader.js';
|
||||
import { validateAll } from './validate.js';
|
||||
|
||||
const logger = {
|
||||
info: (msg: string, ...args: unknown[]) => console.log(`[aggregate] ${msg}`, ...args),
|
||||
@@ -275,6 +276,11 @@ export async function aggregateAll() {
|
||||
if (failed > 0) throw new Error(`${failed}/${configs.length} basket(s) failed`);
|
||||
}
|
||||
|
||||
if (import.meta.url === `file://${process.argv[1]}`) {
|
||||
aggregateAll().finally(() => closePool()).catch(console.error);
|
||||
export async function validateAndAggregateAll() {
|
||||
await validateAll();
|
||||
await aggregateAll();
|
||||
}
|
||||
|
||||
if (import.meta.url === `file://${process.argv[1]}`) {
|
||||
validateAndAggregateAll().finally(() => closePool()).catch(console.error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user