coravel icon indicating copy to clipboard operation
coravel copied to clipboard

Change Task Schedule while app is running

Open tashe opened this issue 3 years ago • 5 comments

Thank you for this cool library. It has many features that I love. There is one feature I need that I think it doesn't implement.

I would like to be able to store add, edit or remove scheduled tasks while my application is still running. These tasks will be stored in the database and updated from time to time. I would like to be able to let Coravel know of these changes and update the task schedules accordingly. The current way of scheduling tasks is by adding them in the Configure() method. This requires us to recompile and restart our app to add new task schedules.

We would also need to pass arguments to these task schedules, as each task (Invocable) can be scheduled for many different times and customers. This also seems like it's a limitation of the current version.

Are these features present in the current version of Coravel or Coravel Pro?

tashe avatar Mar 11 '21 12:03 tashe

There's no official API to do this yet. You can check out this issue for details about how you might go about doing this though. Eventually, this will probably be exposed as a public API since many have asked for it :)

Coravel Pro supports removing and adding schedules from the UI, but not automated from a database. But like I said, you can do it with a bit of work.

jamesmh avatar Mar 11 '21 12:03 jamesmh

I have a similiar requirement. From the UI, when I schedule a task, could I specify specific configuration to be passed to this instance of the task? For example, a single task, that has multiple schedules, and each schedules job has a different email address?

brooksyott avatar Apr 29 '21 12:04 brooksyott

There is an internal API to do this (as mentioned in other comments)... exposing new APIs is always a bit of work + testing + risk. But this seems like such a common scenario. Originally, I was solid on "never" exposing this but like all things....they change and how people are using the library exposes other ways to do task scheduling "easier".

All that to say I think looking into exposing this as a new feature is warranted 🙂

jamesmh avatar Apr 29 '21 13:04 jamesmh

Loving to have the possibility to add/remove/change scheduled task at runtime.

mihaimyh avatar Aug 07 '21 22:08 mihaimyh

@jamesmh

There is an internal API to do this (as mentioned in other comments)... exposing new APIs is always a bit of work + testing + risk. But this seems like such a common scenario. Originally, I was solid on "never" exposing this but like all things....they change and how people are using the library exposes other ways to do task scheduling "easier".

For example, I have a process that runs against a target URL. It would be nice to have this feature so I can easily queue tasks. Instead, i'll have to refactor the code to use the 'QueueEventBroadcast' method instead of task scheduling. Its 100% fine alternative, however, originally I did intuitively look for the features mentioned above!!

Amazing library! and great work on the PRO UI

jeffward01 avatar Mar 29 '23 03:03 jeffward01