feat: implement background job system with queue, worker, scheduler, and handlers
- Add job queue abstraction (InMemoryQueue and Redis/BullMQ adapter) - Add polling worker with retry logic and exponential backoff - Add 6 job handlers: darkwatch.scan, voiceprint.batch, hometitle.scan, removebrokers.process, reports.generate, notifications.send - Add cron-based scheduler with tier-appropriate frequencies (Basic/Plus/Premium) - Add tRPC scheduler router for admin (runJobNow, getJobStatus, etc.) - Add entry point with graceful shutdown support - Achieve 100% test pass rate for new job system
This commit is contained in:
19
web/src/server/api/schemas/scheduler.ts
Normal file
19
web/src/server/api/schemas/scheduler.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { object, string, optional, enumType } from "valibot";
|
||||
|
||||
export const RunJobNowSchema = object({
|
||||
type: string(),
|
||||
payload: object({
|
||||
userId: optional(string()),
|
||||
subscriptionId: optional(string()),
|
||||
requestId: optional(string()),
|
||||
reportType: optional(string()),
|
||||
reportScheduleId: optional(string()),
|
||||
channel: optional(string()),
|
||||
alertId: optional(string()),
|
||||
jobId: optional(string()),
|
||||
}),
|
||||
});
|
||||
|
||||
export const JobStatusSchema = object({
|
||||
jobId: string(),
|
||||
});
|
||||
Reference in New Issue
Block a user