fix(consumer-prices): fold validate into aggregate job, remove separate cron step (#2062)

This commit is contained in:
Elie Habib
2026-03-22 20:29:18 +04:00
committed by GitHub
parent a46cce463e
commit 09dbee1eaa
2 changed files with 8 additions and 3 deletions

View File

@@ -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",

View File

@@ -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);
}