Repository navigation
feat: add scheduled crawls (closes #14) - #55
Open
barunTayenjam wants to merge 1 commit into
Open
barunTayenjam wants to merge 1 commit into
barunTayenjam wants to merge 1 commit into
Conversation
Projects can now have a crawl schedule (hourly, daily or weekly), selected when the project is created or edited. While the server is running, a scheduler ticks every minute and starts a new crawl for every scheduled project whose next run time has passed. - migration 0076: projects.schedule_interval + projects.next_run - models/repository: schedule fields, FindScheduledProjects, UpdateProjectNextRun - SchedulerService with injected clock; next_run always advances (even on error) so a failing project never blocks the schedule; BasicAuth projects are skipped as their credentials are not stored - SaveProject sets next_run; UpdateProject recomputes it only when the interval changes - [scheduler] enabled config (SEONAUT_SCHEDULER_ENABLED), default on - project add/edit forms: schedule select + validation error - translations: schedule strings in en, es, nl, uk, fa - docs: README + INSTALL.md (scheduled crawls section) Verified end-to-end (MySQL 8.4 + local test site): manual crawl produces report/CSV, forcing next_run past due triggers a scheduled crawl within one tick and advances next_run, invalid interval is rejected, restart causes no catch-up burst.
Author
|
CI note (for maintainers): both PR workflows are gated on first-time contributor approval (
Happy to address any review feedback or rebase as needed. |
Author
|
Closing for now while I finish local verification. Will reopen once tested. Sorry for the noise. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #14.
Projects can now have a crawl schedule (hourly, daily or weekly), selected when the project is created or edited. While the server is running, a scheduler ticks every minute and starts a new crawl for every scheduled project whose next run time has passed.
Changes
projects.schedule_interval+projects.next_runFindScheduledProjects,UpdateProjectNextRunSchedulerService(stdlibtime.Tickeronly, injected clock for tests);next_runalways advances (even on error) so a failing project never blocks the schedule; BasicAuth projects are skipped as their credentials are only provided interactively and are not storedSaveProjectsetsnext_run;UpdateProjectrecomputes it only when the interval changes[scheduler] enabledconfig (SEONAUT_SCHEDULER_ENABLED), default onDesign decisions
Verification
go test -race -parallel 1 -short ./internal/...pass,go vetclean,go build -raceclean, gofmt clean on touched filesTestRunOnce*(due/not-due/bogus-interval, error advances, BasicAuth skip),TestSchedule(interval validation + next_run), config scheduler assertionnext_runpast due triggers a scheduled crawl within one tick and advancesnext_run +1h; invalid interval rejected with form error; edit form preselects interval; restart causes no extra crawls