Apply formatting
This commit is contained in:
@ -16,7 +16,7 @@ class BatchScheduler {
|
||||
isRunning: false,
|
||||
canForceStop: false,
|
||||
};
|
||||
|
||||
|
||||
private currentAbortController?: AbortController;
|
||||
|
||||
private readonly SIX_HOURS_MS = 6 * 60 * 60 * 1000; // 6 hours in milliseconds
|
||||
@ -58,7 +58,7 @@ class BatchScheduler {
|
||||
this.state.nextRun = new Date(nextRunTime).toISOString();
|
||||
|
||||
console.log(
|
||||
`🕕 Next batch process scheduled for: ${new Date(nextRunTime).toLocaleString()}`
|
||||
`🕕 Next batch process scheduled for: ${new Date(nextRunTime).toLocaleString()}`,
|
||||
);
|
||||
|
||||
this.state.intervalId = setTimeout(async () => {
|
||||
@ -78,7 +78,7 @@ class BatchScheduler {
|
||||
this.state.isRunning = true;
|
||||
this.state.canForceStop = true;
|
||||
this.state.lastRun = new Date().toISOString();
|
||||
|
||||
|
||||
// Create new AbortController for this batch run
|
||||
this.currentAbortController = new AbortController();
|
||||
|
||||
@ -87,7 +87,7 @@ class BatchScheduler {
|
||||
await batchProcess(this.currentAbortController.signal);
|
||||
console.log("✅ Scheduled batch process completed");
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.name === 'AbortError') {
|
||||
if (error instanceof Error && error.name === "AbortError") {
|
||||
console.log("🛑 Batch process was forcefully stopped");
|
||||
} else {
|
||||
console.error("❌ Error during scheduled batch process:", error);
|
||||
@ -162,4 +162,4 @@ class BatchScheduler {
|
||||
// Export singleton instance
|
||||
export const batchScheduler = new BatchScheduler();
|
||||
|
||||
export type { BatchSchedulerState };
|
||||
export type { BatchSchedulerState };
|
||||
|
Reference in New Issue
Block a user