The Timeout parameter for Acquire Lock is the max amount of time that the session will wait in order to acquire the lock. The only ways to release a lock are either (1) to use the action 'Release Lock', (2) the session ends which will cause the an automatic unlock of the environment lock, or (3) to manually unlock it in the System tab.
That Timeout parameter is the same as the maximum wait time in a Wait Stage when looking for an element, except that in the case of the Acquire Lock action, it doesn't throw an error if it doesn't get the lock in that amount of time. It just continues on the process flow and you need to use a decision stage to determine if the lock was acquired.
------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Original Message:
Sent: 08-26-2019 09:49
From: Sachin J
Subject: What timeout did you put in…
Environment Locks - Acquire Lock Action - Timeout Parameter Issue
I've come across the situation where i wanted to release the lock automatically after few minutes. So I'm passing 5 minutes as time span for Timeout parameter while acquiring the lock, but its not working. Lock is not getting released after 5 minutes, its showing in the locked state. Would anybody have any insight into what may be causing this? We are currently running BP V6.4. Thanks in advance.
------------------------------
Sachin J
RPA Modeler
BNY Mellon Technology
Asia/Kolkata
Original Message:
Sent: 03-27-2019 14:18
From: Dave Morris
Subject: What timeout did you put in…
What timeout did you put in the Acquire Lock action's timeout input? For my explanation below, I'm going to assume you put timeout of zero.
If you put a timeout of zero in Acquire Lock, then one of the sessions (one of the VMs) will get the lock and the other will not. This does not do anything but cause one of the sessions to 'own' a piece of text. They will both go forward. You need a decision stage after that to check this:
[Lock]""""
For the session that acquired the lock, the answer will be True. For the other session, the answer will be False. You would then need to have an alternate path for the False side to skip over the next few steps or have it wait for a period of time or something.
However, let's say you want both of them to do the same set of steps at the same time. That's when you would put a timeout on the Acquire Lock stage. Let's say you put a TimeSpan of 1 hour (Either --""0.1:0:0""-- or --MakeTimeSpan(0,1,0,0)--). The session that acquires the lock will move forward and the other session will stay on the Acquire Lock stage for up to 1 hour. If the first session releases the lock before 1 hour has passed, then the second session will get the lock and move forward. If the first session does not release the lock before 1 hour has passed, then the second session will move forward without getting the lock.
So, basically, you almost always want a decision stage after Acquire Lock to determine the path to take.