refactor: drive FINRA bulk ingest through existing queue_schedule system instead of cron
- Add finra-bulk case to enqueueDueSchedules() — queues a single finra-bulk:finraShortinterest:latest key per cycle - Register default twice-monthly schedule (14-day interval) in seedDefaultSchedules() - Removes need for any external cron; the existing 30s scheduler loop handles it
This commit is contained in:
@@ -300,6 +300,8 @@ export class AdapterQueue implements CacheScheduler {
|
||||
await this.queue(`x:timeline:${a.handle}`);
|
||||
}
|
||||
}
|
||||
} else if (s.source_kind === 'finra-bulk') {
|
||||
await this.queue('finra-bulk:finraShortinterest:latest');
|
||||
}
|
||||
const nextEnqueue = new Date(Date.now() + s.interval_ms).toISOString();
|
||||
this._db.prepare("UPDATE queue_schedules SET last_enqueued=?, next_enqueue=? WHERE source_kind=?").run(now, nextEnqueue, s.source_kind);
|
||||
@@ -315,6 +317,7 @@ export class AdapterQueue implements CacheScheduler {
|
||||
['sec-lint-holders', 7 * 86400000],
|
||||
['sec-lint-insiders', 7 * 86400000],
|
||||
['x', 3600000],
|
||||
['finra-bulk', 14 * 86400000],
|
||||
];
|
||||
const insert = this._db.prepare("INSERT OR IGNORE INTO queue_schedules (source_kind, interval_ms, last_enqueued, next_enqueue) VALUES (?,?,?,?)");
|
||||
for (const [kind, ms] of defaults) {
|
||||
|
||||
Reference in New Issue
Block a user