Skip to content
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

Cron schedule not respection between #790

Closed
rodolfoBee opened this issue Nov 3, 2023 · 6 comments
Closed

Cron schedule not respection between #790

rodolfoBee opened this issue Nov 3, 2023 · 6 comments
Assignees

Comments

@rodolfoBee
Copy link
Member

How do you use Sentry?

Sentry SaaS (sentry.io)

SDK version

3.8.2

Steps to reproduce

Similar to: #782

Example setup:

$schedule->job(....)
->everyFiveMinutes()
->between('9:00', '18:00')
->countries([Country::TR])
->sentryMonitor('__monitor_slug__')
->onOneServer();

Expected result

Monitor is updated with the crontab: */5 9-17 * * *
"Every 5 minutes, between 09:00 and 17:59"

Actual result

Monitor is update with crontab: */5 * * * *
"Every 5 minutes"

Same as the issue linked above, the workaround is to set updateMonitorConfig:false and manually config the monitor in the Sentry UI.

Screenshot 2023-11-02 at 10 55 11
@cleptric
Copy link
Member

cleptric commented Nov 3, 2023

We'll update the docs, we do not support these types of schedules in Sentry.

@rodolfoBee
Copy link
Member Author

Any plans to support it in the future?

@cleptric
Copy link
Member

cleptric commented Nov 6, 2023

This is a question we need to ask the Cron's team cc @gaprl

@gaprl
Copy link
Member

gaprl commented Dec 4, 2023

This is a question we need to ask the Cron's team cc @gaprl

Hey @cleptric we do support the */5 9-18 * * * expression, the only crontab expression we don't support are six-field ones (that includes seconds).

@stayallive
Copy link
Collaborator

We've identified that the problem is also that Laravel currently doesn't expose the information for us to use, so we are unable to know what the ->between schedule is.

If you are curious that is because Laravel uses a closure to "skip" the execution, so a cron with a between schedule is executed in their normal schedule but skipped by a closure outside the range defined in the between call. There are no properties on the event where we can extract that information from to properly define a cron schedule. See: https://github.com/laravel/framework/blob/484e9c2c78637e3484681d7569a0e3f878dcd594/src/Illuminate/Console/Scheduling/ManagesFrequencies.php#L23-L71

@cleptric
Copy link
Member

cleptric commented Dec 6, 2023

We clarified our docs in getsentry/sentry-docs#8643

Tasks that use Laravel's between, unlessBetween, when and skip methods are currently not supported.
For the best results, we recommend using Laravel's cron method to define your schedule's frequency.

@cleptric cleptric closed this as completed Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

4 participants