Commit Graph

2 Commits

Author SHA1 Message Date
b0163d94fb feat: add cron scheduler initialization with validation and mutex integration
All checks were successful
CI/CD Pipeline - Apartment API / Send Webhook Notification (pull_request) Successful in 2s
CI/CD Pipeline - Apartment API / Build & Push Image (pull_request) Has been skipped
CI/CD Pipeline - Apartment API / Deploy to Production (pull_request) Has been skipped
CI/CD Pipeline - Apartment API / Scan Dependencies (pull_request) Successful in 13s
CI/CD Pipeline - Apartment API / Lint & Test (pull_request) Successful in 38s
Implement initializeScheduler() and stopScheduler() functions for the
scraper cron job module. Key features:

- Config-driven enable/disable via SCRAPER_ENABLED environment variable
- Cron expression validation with fallback to default schedule (0 6 * * *)
- Minimum interval enforcement (1-hour floor) to prevent excessive runs
- Timezone support via SCRAPER_TIMEZONE configuration
- Mutex lock integration to prevent concurrent scraper executions
- Automatic lock release in finally block for error resilience
- getScheduleExpression() and getNextScheduledRun() status helpers

Add comprehensive test suite with 42 tests covering mutex locking,
scheduler lifecycle, cron validation, minimum interval enforcement,
concurrent execution prevention, and error handling.
2026-02-06 16:34:49 -07:00
dd0269eb30 SCRAPE-12: Implement in-process mutex (isScraperRunning flag) (#17)
Co-authored-by: Stephen Minakian <stephenminakian@gmail.com>
Co-committed-by: Stephen Minakian <stephenminakian@gmail.com>
2026-02-06 16:27:29 -07:00