diff --git a/CLAUDE.md b/CLAUDE.md index 5e33c16..46ac35d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -55,6 +55,7 @@ The application uses `services/config.ts` for centralized configuration manageme - `ADMIN_PORT`: Admin panel port (default: 3001) - `ADMIN_USERNAME`: Admin panel username (optional, for basic auth) - `ADMIN_PASSWORD`: Admin panel password (optional, for basic auth) +- `DISABLE_INITIAL_BATCH`: Disable initial batch process on startup (default: false) - Podcast metadata and other optional settings Configuration is validated on startup. See README.md for complete list. diff --git a/services/batch-scheduler.ts b/services/batch-scheduler.ts index ea5d1d0..81de6ae 100644 --- a/services/batch-scheduler.ts +++ b/services/batch-scheduler.ts @@ -1,4 +1,5 @@ import { batchProcess } from "../scripts/fetch_and_generate.js"; +import { config } from "./config.js"; interface BatchSchedulerState { enabled: boolean; @@ -21,8 +22,15 @@ class BatchScheduler { private readonly SIX_HOURS_MS = 6 * 60 * 60 * 1000; // 6 hours in milliseconds constructor() { - // Start with initial delay and then schedule regular runs - this.scheduleInitialRun(); + // Check if initial run is disabled via environment variable + if (config.batch.disableInitialRun) { + console.log("⏸️ Initial batch run disabled by configuration"); + // Still schedule regular runs, just skip the initial one + this.scheduleRegularRuns(); + } else { + // Start with initial delay and then schedule regular runs + this.scheduleInitialRun(); + } } private scheduleInitialRun() { diff --git a/services/config.ts b/services/config.ts index 21b4a40..1ed822a 100644 --- a/services/config.ts +++ b/services/config.ts @@ -33,6 +33,11 @@ interface Config { password?: string; }; + // Batch Processing Configuration + batch: { + disableInitialRun: boolean; + }; + // File paths paths: { projectRoot: string; @@ -92,6 +97,10 @@ function createConfig(): Config { password: import.meta.env["ADMIN_PASSWORD"], }, + batch: { + disableInitialRun: getOptionalEnv("DISABLE_INITIAL_BATCH", "false") === "true", + }, + paths: { projectRoot, dataDir,