Code Monkey home page Code Monkey logo

cron's People

Contributors

akasher avatar aleksandr-m avatar bsutton avatar ccl0326 avatar hong1008 avatar isoos avatar langley1996 avatar mbfakourii avatar myconsciousness avatar pescuma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cron's Issues

Support for os-side cron schedule?

Hi isoos! Thx for this great package and I have some question about it.

Can this package support os side cron schedule? For example, I have a task to do and I turned on notification with cron, then I will wait for notify. But before I start my task, there's something more important that I have to cancel this task.
As #4 said, cancel a schedule is easy, but I want to know if it's possible to set a schedule or cancel schedule after reopen the app?

Unable to parse ?

I'm trying to schedule a job that runs every weekday at 7:00, and this is the corn string I'm using: 0 0 7 ? * MON-FRI * which should work but I get an error when scheduling, example:

final cronString = '0 0 7 ? * MON-FRI *';
final cron = Cron();
cron.schedule(Schedule.parse(cronString), () async {
   // do something
});

When I run the above code this is the error:

Exception: Unable to parse: ?
#0      parseConstraint (package:cron/src/constraint_parser.dart:36:3)
#1      new Schedule (package:cron/cron.dart:76:9)
#2      new Schedule.parse (package:cron/cron.dart:96:12)
#3      main (package:dart_oil_job_sync/main.dart:13:26)
#4      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#5      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

Should I use some other syntax? Is there an example?

Multiple tasks problem seconds vs minutes

main() {
  final cron = Cron();
  cron.schedule(Schedule.parse('*/3 * * * * *'), () async {
    print('every 3 sec');
  });
  cron.schedule(Schedule.parse('*/5 * * * *'), () async {
    print('every 5 min');
  });
}

The every 3 seconds cron won't work in above code. Seems like if there is a minute scheduled task in the same cron then seconds scheduled task is ignored.

[QUESTION] Screen goes off

Hi, I have a question: if the screen goes off/screen is locked, does the cron job still execute every X minutes?

does it wait for the execution to end?

Hi Isoos,

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

  • the periodic cron, eg 3minutes, will happen in every 3 minutes or when the function ends it waits for 3 minutes and execute again?
  • Is this exactly like the cron of linux?

Idea to Add IsRunning method

hi.

thank you for your package help me a lot.

can you add/release please new method to check if isRunning ?

regards,
Tomer.

How to close instance of cron to create a new one

I want to give my users the ability to set the cron job to run at their day and time specifications. I have that working properly, but I'm left with multiple scheduled cron jobs. I would like to invalidate the previous cron job so that it doesn't run anymore at all. I had hoped that calling close() would kill the old process, but, as stated in the docs, it only prevents that instance from getting new scheduling.

I have a cronjob class that has the variable final cron = new Cron() and I schedule from another class.

How can I completely kill any previous scheduling so I can start fresh for scheduling?

Will this work in the background or not (flutter)?

First of all, I'm not asking it to be work in the background.

There was already a closed issue #9 , but I believe it shouldn't have been closed.

The question asked there is what I want to learn.

Q:

Hi. Does this plugin run process in background, when the app is closed?
Or does it run when app is in foreground only?
Not much information is given.

A:

Hi, this package is for server-side apps, which run for a longer time. I'm sorry, but I have no idea how to achieve the same in a mobile app.

The answer assumes the user wants to use this in background and tries to achieve that functionality. However, question simply wanted to learn the behavior.

I think this information is crucial and should be in the readme.

Cron is Best in the Field, Why not we Try to Enhance Cron to Background-Processes

Cron is doing the most different and new thing, Thanks to the @agilord
There is no other software, better than Cron, in the pub. dev.

People are coming to use cron as for background processes,
People are loving the foreground processes of the cron,
I am a developer who loves to work with cron and its easy-to-use interface.
People are giving the signal, that they want background processes as soon, because there are not better packages that are efficient like cron,

Why Don't we develop Cron to background Processes,
Just ask ourselves, for how long we are gonna say Cron as Server-side Development Package?

@agilord has developed a great technology and it is the best in the field,
By using Different Packages that already exist, ex, work manager, move_to_background, flutter_background we can achieve this easily.

People are giving the signal, that they want background processes as soon, because there are not better packages that are efficient like cron,

`shouldRunAt` method in `Schedule` doesn't account for weekdays

Current method:

bool shouldRunAt(DateTime time) {
    if (seconds?.contains(time.second) == false) return false;
    if (minutes?.contains(time.minute) == false) return false;
    if (hours?.contains(time.hour) == false) return false;
    if (days?.contains(time.day) == false) return false;
    if (months?.contains(time.month) == false) return false;
    return true;
}

Shouldn't it be more like:

bool shouldRunAt(DateTime time) {
    if (seconds?.contains(time.second) == false) return false;
    if (minutes?.contains(time.minute) == false) return false;
    if (hours?.contains(time.hour) == false) return false;
    if (days?.contains(time.day) == false) return false;
    if (weekdays?.contains(time.weekday) == false) return false;
    if (months?.contains(time.month) == false) return false;
    return true;
}

Will Cron run if the device is restarted

Hello, First of all, This Plug-in is just awesome and thanks a lot for that.

Please can you let me know that if the Cron will still run if the App is terminated (Force Stopped) or the Mobile is restarted?

cron execute bug

hi , why when i start two cron use one Cron instance like below:
one cron is every twenty seconds to print something; anothre cron is every two minutes to print something
then the print is unexpected, the two minutes print will print 60 times every two minute;the twenty seconds print seems ok

Isn't it a bug??? it should print one time at every two minutes, why it print so many times at every two minutes???
1
2

however if two cron use more than 59s the print is ok
3

Background process?

Hi. Does this plugin run process in background, when the app is closed?
Or does it run when app is in foreground only?
Not much information is given.

Thank you.

Schedule times differently

How can i schedule crone
After 15 minutes the first time
And than after each hour

until it is closed by user

Support better exception handling on parse

Currently when parsing a schedule the cron library throws an Exception when a parse fails.

This is difficult to catch as it is too generic.

Can we replace this with a specific exception such as:

ScheduleParseException
ParseException

or maybe FormatException - not my preferred as it is used by other functions.

Maybe the package structure should be refactored?

Hi amazing developers,

The functionality of this package seems complete, but the structure of the package appears somewhat complex.
So shouldn't it be refactored to the extent that there are no destructive changes?

For example, most implementations are currently in cron.dart under the lib folder, but these should be splitted per class and stored in lib/src.
This alone would make the package much more maintainable.

Thank you.

Is there a job manager?

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?

Hello Sir,

I want run core after 30 seconds how can i do that

second based scheduling isn't reliable

As I understand it, the scheduler works by setting a timer to go off every second.

The problem with this is that in an async environment, a compute-heavy workload can result in the timer being delayed.

When doing a seconds-based schedule this can mean that the task may never be run as the scheduler checks that the current time = the schedule no. of seconds.

The result is that cron is unreliable for seconds based scheduling and may be unreliable for minutes based scheduling if a very heavy process is run.

Ideally, we need to guarantee that tasks are run, even if they are late.

Schedulte every 2 hours starting at 15pm

Currently, it is not possible to set :

15/2 => Every 2 hours starting at 3pm....

For example :

'* 15/2 23 12 *' => Should be : Every 2 hours, starting from 23/12 at 3PM...

Is it scheduled for a next release ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.