Thanks to visit codestin.com
Credit goes to github.com

Skip to content

autostart: make schedule cron string a full 5-valued for compatibility #993

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

Closed
Tracked by #850
johnstcn opened this issue Apr 13, 2022 · 2 comments · Fixed by #1049
Closed
Tracked by #850

autostart: make schedule cron string a full 5-valued for compatibility #993

johnstcn opened this issue Apr 13, 2022 · 2 comments · Fixed by #1049
Assignees
Labels
api Area: HTTP API
Milestone

Comments

@johnstcn
Copy link
Member

Originally we only made the autostart backend a 3-valued cron string, but most cron libraries only handle the traditional 5-valued cron string. This would allow us to reduce some complexity in the frontend code.

I think so, but only if the backend was validating that we always received a full valid 5-value cron string (with optional timezone). The only reason it would help is so that I know I can pass these strings directly from the backend into JS cron libraries for validation and display.

I plan on making the C/U form a set of widgets that under the hood produce a cron string. So imagine an input for your timezone, one for time and another with the 7 days of the week that you select/deselect.

Originally posted by @vapurrmaid in #991 (comment)

@johnstcn johnstcn self-assigned this Apr 13, 2022
@johnstcn johnstcn added this to the V2 Beta milestone Apr 13, 2022
@johnstcn johnstcn added V2 BETA api Area: HTTP API labels Apr 13, 2022
@greyscaled
Copy link
Contributor

greyscaled commented Apr 13, 2022

I had since updated my answer, very specifically the requirements are that:

  • the backend will always validate that it receives a valid 5-value cron string
  • the backed will validate that the d-of-m and m values are *

The latter could appear as an unnecessary constraint; but the reason I want to start this is way is that it simplifies the level of effort to launch support for weekly only. Should more complicated schedules be required later on, we can lift the validation that d-of-m and m are * without a data migration, and simply add those inputs in the FE.

@johnstcn
Copy link
Member Author

  • with an optional prefix matching CRON_TZ=\S+\s

johnstcn added a commit that referenced this issue Apr 18, 2022
…atibility (#1049)

This PR modfies the original 3-valued cron strings used in package schedule to be traditional 5-valued cron strings.

- schedule.Weekly will validate that the month and dom fields are equal to *
- cli autostart/autostop will attempt to detect local timezone using TZ env var, defaulting to UTC
- cli autostart/autostop no longer accepts a raw schedule -- instead use the --minute, --hour, --dow, and --tz arguments.
- Default schedules are provided that should suffice for most users.

Fixes #993
@misskniss misskniss mentioned this issue May 6, 2022
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Area: HTTP API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants