agilord / cron

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

Is there a job manager? #25

Open Babsky opened 3 years ago

Babsky commented 3 years ago

Hey, love the cron package, perfect for what I need and easy to use apart from this one question - is there a manager or viewer for cron jobs? I created a cron schedule in my flutter app but as I'm testing I have made changes to it, in affect I assume, creating a new schedule (maybe?) Now the command seems to trigger at a time I've never set so I'm wondering how can I view/edit/delete schedules?

isoos commented 3 years ago

This is the first time this requirement is mentioned, and while I don't have much time to develop it, I'm happy to accept a PR :)

On the triggering: the package is designed for server apps, where the app is running uninterrupted. On mobile, it may be suspended, and that could explain if the trigger hits at a different time.

Babsky commented 3 years ago

I'm surprised it hasn't come up before, as cron itself has a job manager. Anyway, I've had my app running for a few hours now, I have the schedule ('0,1 0 * '), which I assume is midnight and 1 minute past midnight daily but the command is firing every hour and 1 minute past every hour. I've commented it out now so it will be interesting to see what happens when I next run the app. It's a bit confusing as there is cron and there is your cron package but I'm sure I read somewhere that your cron package still runs when the app is closed. If that isn't the case then I'll have to look for a replacement, which would be a shame.

isoos commented 3 years ago

Anyway, I've had my app running for a few hours now, I have the schedule ('0,1 0 * '), which I assume is midnight and 1 minute past midnight daily but the command is firing every hour and 1 minute past every hour.

This looks like a bug. A recent change around second-based schedules might have introduced it.

It's a bit confusing as there is cron and there is your cron package but I'm sure I read somewhere that your cron package still runs when the app is closed.

Not sure where did you read, I have no claim on this one. I have no clue how the package behaves on mobile :|

isoos commented 3 years ago

@Babsky: I've published a new version: the bug was happening because of the extra space in you schedule that needed parsing, the new version has a fix for it.

Babsky commented 3 years ago

Awesome, thank you 👍 I don't remember where I read about running when the app is closed tbh, there's so much info out there. There is a possibility I got confused and was thinking of a different type of package, I was looking at notification packages around the same time so maybe it was one of them?

I did notice the addition of 'seconds' in the updated package but when I tried adding another '*' I got an error so removed it again. I will update to 0.3.2 and see how it goes. Thanks again 👍