I'm fairly new to SpringBoot, and trying to use @Scheduled to execute a certain task with delays.
I know there is fixedDelay
parameter that can set to have a fixed delay between two executions in a row.
What I need is, is there anyway to set a random delay between every two executions? (I mean every delay is randomly set, but not having a random delay set to fixedDelay)
What I can come up with is, use a fixedDelay
, plus a random seconds of Thread.sleep()
inside the execution, but feel like there should be a more correct way to do this.