SCRAPE-32: Integrate scraper scheduler in server.js #31

Merged
stephen merged 1 commits from scraper/server-integration into dev 2026-02-08 20:08:43 -07:00
Owner

Summary

Integrates the scraper scheduler, index creation, and signal handlers into the server.js startup flow.

Changes

  • Imports createScraperIndexes, initializeScheduler, and registerSignalHandlers into server.js
  • Creates scraper indexes during connectToMongoDB() startup
  • Conditionally starts the cron scheduler when SCRAPER_ENABLED is true
  • Registers SIGTERM/SIGINT signal handlers for graceful shutdown
  • All scraper init wrapped in try/catch so failures do not crash the server

Tests

Added 11 integration tests covering startup behavior, error handling, SCRAPER_ENABLED guard, and signal handler registration.

All 18 test suites pass (696 tests passed).

## Summary Integrates the scraper scheduler, index creation, and signal handlers into the server.js startup flow. ### Changes - Imports createScraperIndexes, initializeScheduler, and registerSignalHandlers into server.js - Creates scraper indexes during connectToMongoDB() startup - Conditionally starts the cron scheduler when SCRAPER_ENABLED is true - Registers SIGTERM/SIGINT signal handlers for graceful shutdown - All scraper init wrapped in try/catch so failures do not crash the server ### Tests Added 11 integration tests covering startup behavior, error handling, SCRAPER_ENABLED guard, and signal handler registration. All 18 test suites pass (696 tests passed).
stephen added 1 commit 2026-02-08 20:07:00 -07:00
Integrate scraper scheduler and index creation into server.js startup
All checks were successful
CI/CD Pipeline - Apartment API / Scan Dependencies (pull_request) Successful in 13s
CI/CD Pipeline - Apartment API / Lint & Test (pull_request) Successful in 44s
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
e39a2643b9
Add scraper initialization to the connectToMongoDB() startup flow:
- Import createScraperIndexes, initializeScheduler, and
  registerSignalHandlers from their respective service modules
- Create scraper database indexes during MongoDB connection setup
- Conditionally start the cron scheduler when SCRAPER_ENABLED is true
- Register SIGTERM/SIGINT signal handlers for graceful shutdown

All scraper initialization is wrapped in try/catch so failures are
logged but do not prevent the server from starting. This ensures
existing API functionality remains unaffected even if scraper
components encounter errors during startup.

Add 11 integration tests covering startup behavior, error resilience,
SCRAPER_ENABLED guard, and signal handler registration.
stephen merged commit 66f545bc75 into dev 2026-02-08 20:08:43 -07:00
stephen deleted branch scraper/server-integration 2026-02-08 20:08:43 -07:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: stephen/apartment-dashboard-api#31
No description provided.