coravel icon indicating copy to clipboard operation
coravel copied to clipboard

Allow for more dynamic scheduling

Open kajbonfils opened this issue 3 years ago • 5 comments

I have a setup, where I get an interval for running a cleanup job from my AppSettings, e.g. 2 for running every two hours.

There is a function for scheduling EverySeconds, that takes an int between 0 and 59. But I do not have a similar function for EveryHours or EveryMinutes which limits me. It would be great to have these functions or alternatively -and maybe even better - It would be nice to have a function that alows to schedule more dynamically, e..g.

.Every(3, Hours)

kajbonfils avatar Mar 17 '21 08:03 kajbonfils

To schedule for EveryMinutes just use EverySeconds and multiple by 60. For hours just multiply by 3600. Seems simple enough to add your own extension method that does this for you if you need it to be "visually cleaner", but as far as functionality you can do what you need with EverySecond().

falvarez1 avatar Apr 02 '21 04:04 falvarez1

You can technically try this using the CRON method. That's how I've done it - works well. What do you think @kajbonfils ?

jamesmh avatar Apr 02 '21 12:04 jamesmh

@falvarez1 I get System.ArgumentException: 'When calling 'EverySeconds(int seconds)', 'seconds' must be between 0 and 60' when calling EverySeconds with e.g. 3600.

@jamesmh I suppose that will work. I will give it a try. Still could be nice with an extension method as CRON syntax is jiberish to most people.

kajbonfils avatar Apr 22 '21 09:04 kajbonfils

You can technically try this using the CRON method. That's how I've done it - works well. What do you think @kajbonfils ?

if there was some API for manage the Invocables. thats will be better ?

like:

API For Use
Add for dynamic add job to Scheduler not Run
AddRun for dynamic add job to Scheduler and Run immediately
AddDelayRun for dynamic add job to Scheduler and Delay Run
Run/Pause Run immediately/Pause:Stop Scheduler temporary until Call Run or Next Host Startup
Enable/Disbale Disbale : stop Scheduler from now until call Enable
Delete delete job from Scheduler
GetAllJobs return all jobs from Scheduler
GetSchedule return Schedule plan
ChangeSchedule change Schedule plan immediately for next time
ChangeScheduleDelay change Schedule plan Delay for next time
ForceStop Force stop the running job(if the job is running)

sgf avatar Nov 12 '21 07:11 sgf

This is still an issue here - the lack of EveryMinutes() and EveryHours() is limiting.

AlanPBourke avatar Oct 04 '23 16:10 AlanPBourke