-
Notifications
You must be signed in to change notification settings - Fork 410
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
[MacOs] Cannot schedule job to run after x minutes if machine sleeps. #318
Comments
Whilst I'm not the author, I do use this library in a personal project and very much like it... @akshaypawar123 - I wouldn't expect the behavior you are expecting :-) If at 12:00 my app starts up and then schedules a job for 5 minutes time, I would definiately expect it to run at the clock time of 12:05 or as soon as possible subject to external factors (other jobs taking CPU cycles or indeed the host being suspended). I can't think of a sensible way for the scheduler to measure 'potential run time because the host is awake' to accurately run the job after 5 minutes of awake time vs clock time. That said, one super crude hack would be to have the job run (say) every minute, keep some internal state, and then when the counter gets to 5 to actually run the logic. Of course, the best solution might be to not put the host to sleep if its meant to be doing scheduled jobs... 😊 |
Hey, thanks a lot for your response.
Just some more contextion how I use it.
My main program launches an asynchronous process. I use FluentScheduler
job to run after x mins and abort the process if it is not completed.
In current setup, the asynchronous process suspends execution when machine
sleeps, but FluentScheduler doesn't. So the async process is aborted
earlier than it should. How would you recommend handling this scenario with
FluentScheduler?
…On Sat, Mar 12, 2022, 5:03 PM G fisher ***@***.***> wrote:
Whilst I'm not the author, I do use this library in a personal project and
very much like it...
@akshaypawar123 <https://github.com/akshaypawar123> - I wouldn't expect
the behavior you are :-)
If I start at 12:00 my app starts up and then schedules a job for 5
minutes time, I would definiately expect it to run at the clock time of
12:05 or as soon as possible subject to external factors (other jobs taking
CPU cycles or indeed the host being suspended).
I can't think of a sensible way for the scheduler to measure 'potential
run time because the host is awake' to accurately run the job after 5
minutes of awake time vs clock time. That said, one super crude hack would
be to have the job run (say) every minute, keep some internal state, and
then when the counter gets to 5 to actually run the logic. Of course, the
best solution might be to not but the host to sleep if its meant to be
doing scheduled jobs... 😊
—
Reply to this email directly, view it on GitHub
<#318 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALGNM2EW6WTVVT7SESJVEOTU7R6HVANCNFSM5QPOS4HQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hello All,
I am trying to schedule a job to run once after x minutes, but want to make sure the time passed when machine sleeps is not counted.
I am not seeing expected behavior in below scenario:
Expected behavior : Scheduled job is triggered 4 minutes (1 minute has already passed) after wakeup.
Actual behavior : Scheduled job is triggered immediately after machine wakesup.
Are there any properties that need to be set to make this work? Thanks!
The text was updated successfully, but these errors were encountered: