Is it necessary to set LockAtMostFor and LockAtLeastFor?

5.1k views Asked by At

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" ?

2

There are 2 answers

1
Lukas On BEST ANSWER

You do not have to set lockAtLeastFor. On the other hand lockAtMostFor has to be set just in case the node executing the taks dies. The lock gets automatically released after that time.

0
sadath pasha On

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.