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

Would you pls tell me why the value of “lockAtLeastFor” is 14m #2137

Open
engineerping opened this issue Sep 10, 2024 · 0 comments
Open

Comments

@engineerping
Copy link

Dear team,
Thanks a lot for your distribution,

There is an example in the README.md file

_Let's say you have a task which you execute every 15 minutes and which usually takes few minutes to run. Moreover, you want to execute it at most once per 15 minutes. In that case, you can configure it like this:

import net.javacrumbs.shedlock.core.SchedulerLock;

@scheduled(cron = "0 */15 * * * *")
@SchedulerLock(name = "scheduledTaskName", lockAtMostFor = "14m", lockAtLeastFor = "14m")
public void scheduledTask() {
// do something
}_

I am a bit confused that:

  1. why does the value of lockAtLeastFor is 14m instead of 1m or 2m? After all,according to doc,Its main purpose is to prevent execution from multiple nodes in case of really short tasks and clock difference between the nodes
  2. does the value of lockAtMostFor must less than 15m in the example? because of the @scheduled(cron = "0 */15 * * * *")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant