Allow crontab schedule - #756
Open
nocoolnametom wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the Stash Scheduler plugin’s “Scan Frequency” setting to accept a standard 5-field crontab expression, enabling more precise scan schedules than the existing hourly/daily/weekly options.
Changes:
- Update plugin settings help text to document 5-field crontab expressions and their precedence over Time of Day / Day of Week.
- Add cron-expression detection + validation during settings coercion, persisting the parsed expression as
cron_expr. - Add a new daemon scheduling branch that uses
CronTrigger.from_crontab()when frequency is set to cron mode.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| plugins/stash-scheduler/stash-scheduler.yml | Documents crontab scheduling support and clarifies how it interacts with other scheduling settings. |
| plugins/stash-scheduler/stash_scheduler.py | Implements cron-expression detection/validation and adds a cron scheduling path in the daemon and status messaging. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+186
to
+190
| def _is_cron_expr(value): | ||
| """Return True if value looks like a 5-field crontab expression.""" | ||
| import re as _re | ||
| parts = _re.split(r'\s+', str(value).strip()) | ||
| return len(parts) == 5 and any(c in value for c in (' ', '\t')) |
Comment on lines
+197
to
+200
| raw_freq = str(settings.get("frequency", "daily")).strip() | ||
|
|
||
| if _is_cron_expr(raw_freq): | ||
| # Validate the cron expression via APScheduler if available; otherwise |
|
This pull request has been mentioned on Stash Forum. There might be relevant details there: |
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.
This allows setting the schedule using crontab format