agilord / cron

A cron-like time-based job scheduler for Dart
BSD 3-Clause "New" or "Revised" License
118 stars 23 forks source link

does it wait for the execution to end? #3

Open jodinathan opened 5 years ago

jodinathan commented 5 years ago

Hi Isoos,

Thanks for the package and sorry bothering, but I am not a cron expert, so I've got a couple of questions...

isoos commented 5 years ago

will happen in every 3 minutes or when the function ends it waits for 3 minutes and execute again?

The code is written in a way that every 3 minutes, it tries to execute again, unless the previous is still running. Once it completes, the new one starts immediately. I haven't used and tested that part of the code, so proceed with caution :)

(A flag should be easy to add to control the behaviour there.)

Is this exactly like the cron of linux?

The schedule syntax is similar, but not everything may be supported. What are you looking for?

gitboss commented 5 years ago

Do the scheduled jobs persist even after a reboot from the user?

isoos commented 5 years ago

Do the scheduled jobs persist even after a reboot from the user?

The library does not use any persistence to store job states. What would be your use case?

gitboss commented 5 years ago

For example something similar to an alarm at 5:00 AM everyday.

isoos commented 5 years ago

I understand the scheduling part, but I miss the context on the persistence. Or are you referring to the periodicity?

gitboss commented 5 years ago

I'm sorry for the confusion, yes I meant will the jobs start at the scheduled time even after the device is rebooted or when the app is not in the memory. So for example will there be an alarm at 5AM everyday even after the user has rebooted the device or the app is no longer in the memory. Thanks for your time, really appreciate.

isoos commented 5 years ago

This library does not change the OS-level scheduling (e.g. cron on Linux, or any setting on a mobile phone): it is only a timer solution to run tasks as long as the main Dart/Flutter program is running. My main use is on the server, and I'm sorry, but I have no experience how this would run on Flutter and what it means for the app lifecycle.