Wisp icon indicating copy to clipboard operation
Wisp copied to clipboard

Log next schedule after completion

Open andywilson opened this issue 3 years ago • 3 comments

Thank you, this is a great library and very useful. One thing that would be handy is to know the next time a job is going to run after it has completed.

We've a lot of jobs scheduled, so I'd rather not iterate through and log out all their stats on a separate fixed schedule.

Perhaps you could add a post execution hook, or simply debug log the result in Scheduler.scheduleNextExecution?

andywilson avatar Dec 22 '21 10:12 andywilson

Thank you for your feedback and your interest in Wisp!

Actually this feature is already available through:

  1. Keeping a reference of the job after the scheduling or getting one through scheduler.findJob(String name)
  2. Getting the duration in milliseconds of when the job is going to execute next with: job.nextExecutionTimeInMillis()

amanteaux avatar Dec 22 '21 11:12 amanteaux

That's fine for the first time a job is scheduled, but I also want to show this at the end of every subsequent execution in the schedule. Since the next execution time is only set after executing my job, I can't see a way of triggering this. I could log from the schedule at the point of setting the next execution time, but that wouldn't have the associated job information. Do you have any suggestions?

andywilson avatar Dec 22 '21 14:12 andywilson

Do you think you can elaborate your use case? I am not sure I get the goal of this.

Because if you are trying to build some table that gives you some stats for the schedule jobs or even force the execution of a job, you can do something like this: https://github.com/Coreoz/Plume-admin/blob/master/plume-admin-ws-system/src/main/java/com/coreoz/plume/admin/services/scheduled/AdminSchedulerService.java

amanteaux avatar Dec 27 '21 18:12 amanteaux

I am closing this issue because I do not have feedback.

Feel free to reopen if needed.

amanteaux avatar May 19 '23 08:05 amanteaux