Whether it is necessary to set values LockAtMostFor and LockAtMostFor for a task that is executed once a month, the execution time is several minutes, there are several nodes with a running service. How correct will it be to expose values to
lockAtLeastFor = "PT1H" lockAtMostFor = "15m"
?
Is it necessary to set LockAtMostFor and LockAtLeastFor?
5.1k Views Asked by sdkdan At
2
There are 2 best solutions below
0
![](/img/user-default.png)
If you want the task to be run by only one node then it is necessary to add lockAtLeastFor and lockAtMostFor .
lockAtLeastFor : Should be the value taken by your task to get completed.
lockAtMostFor : should be lockAtLeastFor + some buffer time .
if lockAtLeastFor is too small then the same task can be picked up by other node.(Job will run in multiple nodes not in one node)
if lockAtMostFor is not set or set to high value and your node dies after acquiring the lock
No other node can acquire the lock.
You do not have to set
lockAtLeastFor
. On the other handlockAtMostFor
has to be set just in case the node executing the taks dies. The lock gets automatically released after that time.