hasura / hasura/graphql-engine
Add a convenient way to temporarily disable scheduled events
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Is your proposal related to a problem?
We recently had the need to temporarily disable a scheduled event (every night at midnight), but ran into the following problems:
- Manually setting the cron trigger schedule to never run failed validation.
- Pushing out a metadata change to remove the trigger from our production environment would have taken a considerable amount of time and effort (plus later effort to restore it). Also: removing the trigger and re-adding it later has the side-effect of losing processed events and invocation logs.
- Manually applying the metadata change to our production environment through the CLI carried the risk of that change being reset by any other metadata deployments taking place (adding an unrelated feature, for example).
- Deleting "Pending events" manually from the console UI didn't seem like a reliable way to prevent the trigger from running because A) we weren't sure if the events would be recreated during any other deployment (as mentioned above), and B) we didn't have a defined end date from our client.
### Describe the solution you'd like
What we'd like to request is to add a feature to help temporarily suspend a scheduled cron trigger from the console UI (and/or CLI), which is immune to metadata redeployments.
I think the ideal solution would be a simple "Disable" / "Enable" button on each cron trigger, similar to the existing "Update Cron Trigger" and "Delete trigger" buttons at the bottom of the page.
- Disabling the trigger would remove all pending events from the database.
- Re-enabling the trigger would recreate all pending events in the database.
- Processed events and invocation logs would remain available.
- When reapplying metadata, Hasura can lookup the existing status of an identical cron trigger. If an identical trigger is found, it will remain untouched and its enabled/disabled status will remain untouched.
### Describe alternatives you've considered
Contributor guide
Research direction
Start by reviewing the existing cron trigger controls in the console UI and CLI, along with the scheduled-event handling they invoke. Compare the requested disable and enable behavior with metadata redeployments, pending events, processed events, and invocation logs. Done means the design supports persistent trigger status and the listed disable/enable semantics without losing historical data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend, cli, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100