Skip to content
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

Support one off scheduled tasks #23899

Closed
behrangsa opened this issue Oct 31, 2019 · 1 comment
Closed

Support one off scheduled tasks #23899

behrangsa opened this issue Oct 31, 2019 · 1 comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression)

Comments

@behrangsa
Copy link

Sometimes I want to have a task that runs 1M after the app starts as well as once a day at 1AM.

Right now, there doesn't seem to be an option using @Scheduled to do this.

A workaround is to annotate the method like this:

@Scheduled(cron = "...")
@Scheduled(initialDelayString = "PT1M", fixedDelay = Long.MAX_VALUE)
public void doSomething() {
}

It would be nice if @Scheduled had an attribute such as runOnce=true|false and/or maxRuns=integer to control how many times a scheduled job is allowed to run.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 31, 2019
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Nov 10, 2021
@snicoll
Copy link
Member

snicoll commented Sep 27, 2023

Thanks for the suggestion and sorry it took so long to process it.

This has been implemented recently, see #31211

@snicoll snicoll closed this as not planned Won't fix, can't repro, duplicate, stale Sep 27, 2023
@snicoll snicoll removed the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression)
Projects
None yet
Development

No branches or pull requests

4 participants