-
-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting onFailure for RecurringTaskWithPersistentSchedule #329
Allow setting onFailure for RecurringTaskWithPersistentSchedule #329
Conversation
Makes sense. What is your particular need? |
@kagkarlsson Without the ability to set a failure handler, I had to do this which is kinda hacky public record ScheduleData(ZoneId zoneId, LocalTime time, String id)
implements ScheduleAndData, Schedule {
@Override
public Schedule getSchedule() {
return this;
}
@Override
public String getData() {
return id;
}
@Override
public Instant getNextExecutionTime(ExecutionComplete executionComplete) {
if (executionComplete.getResult() == Result.FAILED)
return executionComplete.getTimeDone().plus(RETRY_DELAY);
return Schedules.daily(zoneId, time).getNextExecutionTime(executionComplete);
}
@Override
public boolean isDeterministic() {
return true;
}
} It would be nice to not have to override the EDIT It's only a tiny change. There are a few other tiny improvements observed and I'm not certain what the recommendations are. Batch them in a single PR or separate in multiple PRs? |
The changes proposed:
|
Will have a look at this on Friday |
I think split out task-resolver and clock stuff into a separate PR, then this PR will be fine. I might merge it and remove those bits, to be able to merge the FailureHandler change today. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will merge this PR, but remove the clock, task-resolver change. I think those changes will block the merge otherwise, and was hoping to release a new version today
public SchedulerBuilder taskResolver(TaskResolver taskResolver) { | ||
this.taskResolver = taskResolver; | ||
return this; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am uncertain what the use-case for this is. If you do not use the default or a variant of it not much will work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you have commented a bit on it. We can take the discussion in another PR
public SchedulerBuilder clock(Clock clock) { | ||
this.clock = clock; | ||
return this; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the use-case for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you have commented a bit on it. We can take the discussion in another PR
I think we need to discuss this:
To avoid circular dependency, you can get a |
No description provided.