Skip to content

feat(#18): add POST /api/admin/backfill for historical deep crawl#24

Merged
Jing-yilin merged 2 commits intodevelopfrom
feature/18-backfill
Feb 27, 2026
Merged

feat(#18): add POST /api/admin/backfill for historical deep crawl#24
Jing-yilin merged 2 commits intodevelopfrom
feature/18-backfill

Conversation

@Jing-yilin
Copy link
Contributor

Closes #18

Changes

  • Add RunBackfill() to CronService: same upsert logic with deeper page depths (newest=25, magic=15, end_date=10)
  • All depths overridable via BACKFILL_DEPTH_* env vars
  • New handler: POST /api/admin/backfill — triggers async, returns 202 immediately

Stack

PR 6/6 (last in stack). Base: #23 (backers_count)

Copy link
Contributor Author

@Jing-yilin Jing-yilin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: POST /api/admin/backfill is exposed on the public API with no auth, rate limit, or mutual exclusion. Any caller who can reach the service can trigger an expensive background crawl repeatedly, and concurrent requests will start overlapping backfills against ScrapingBee and the DB. Given the credit cost and runtime, this needs at least an admin secret or auth gate plus a single-flight guard before it is safe to ship.

Add RunBackfill() to CronService: same upsert logic as RunCrawlNow but
with deeper page depths (newest=25, magic=15, end_date=10 by default,
all overridable via BACKFILL_DEPTH_* env vars).
Expose via POST /api/admin/backfill; runs async and returns 202 immediately.
@Jing-yilin Jing-yilin force-pushed the feature/16-backers-count branch from 70b986a to 6bff708 Compare February 27, 2026 10:29
@Jing-yilin Jing-yilin changed the base branch from feature/16-backers-count to develop February 27, 2026 10:29
@Jing-yilin Jing-yilin merged commit 05bdb70 into develop Feb 27, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant