Repository navigation
feat(manifest): give scheduled tasks a default schedule #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8994fa3
feat(manifest): give scheduled tasks a default schedule
Quick104 f18b79f
test(convert): check stored scheduled task metadata decodes with unkn…
Quick104 37fa1a0
docs(manifest): say which hosts refuse a plugin that sets a default s…
Quick104 1b0ac8f
chore: remove example binaries committed by mistake
Quick104 c9fba73
docs(scheduled-task): state the time zone, one run per firing, and st…
Quick104 ba04b73
fix(manifest): refuse a default interval too long for a host timer
Quick104 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Scheduled tasks | ||
|
|
||
| A `scheduled_task.v1` capability is a job the host runs on a schedule. The | ||
| host calls `ScheduledTask.Run` with the task's key each time the schedule | ||
| fires. When Silo runs several API servers, one of them takes each run; the | ||
| others skip it. | ||
|
|
||
| An administrator sets the schedule on the host. Until they do, the host uses | ||
| the capability's default: | ||
|
|
||
| ```json | ||
| { | ||
| "type": "scheduled_task.v1", | ||
| "id": "health_check", | ||
| "display_name": "Health check", | ||
| "scheduled_task": { | ||
| "default_trigger": { "type": "interval", "interval_ms": 300000 } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| | `type` | Fields | Runs | | ||
| |---|---|---| | ||
| | `interval` | `interval_ms`, from 60000 to 9223372036854 | Every `interval_ms` milliseconds. | | ||
| | `daily` | `time_of_day`, `"HH:MM"` | Once a day at that time, in the time zone of the Silo server process (its `TZ`; UTC in the default container). | | ||
| | `weekly` | `time_of_day`, `day_of_week` (0 is Sunday) | Once a week, in the same time zone. | | ||
| | `startup` | none | Once when Silo starts. Servers that start together share one run. | | ||
|
|
||
| Without a default, a task the administrator hasn't scheduled runs once when | ||
| Silo starts. | ||
|
|
||
| Many servers install the same plugin with the same default, so a task that | ||
| calls an outside service at `03:00` reaches it from all of them at once. Wait | ||
| a random few minutes at the start of `Run`, or pick an unusual time. The trigger type vocabulary is open: a host uses its own | ||
| default for a type it doesn't know. | ||
|
|
||
| A host that predates `scheduled_task` ignores it, and runs the task once each | ||
| time it starts, only if it drops unknown fields wherever it reads the manifest. | ||
| The SDK's `manifest.Load` always has. A Silo host built before | ||
| Silo-Server/silo-server#2502 does not: it reads a bare plugin binary's manifest | ||
| strictly, and before starting a plugin it compares the installed manifest with | ||
| the one the plugin reports, unknown fields included. It refuses to install a | ||
| binary that sets `scheduled_task` and refuses to start such a plugin installed | ||
| from an archive. | ||
|
|
||
| A task that has to run at a time each user picks, such as a weekly digest | ||
| sent in each user's own time zone, can run every hour and decide per user | ||
| whether it's time. | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.