Description
Attempts to acquire a named cluster-wide lock.
If a lock with the same name already exists, returns
If the timeout parameter is specified this call will waits 1 + n seconds to acquire the lock, retrying once every second until it succeeds. If not specified no timeout will occur - the getLock call will fail after the first unsuccessful attempt.
Locks are not cleared automatically. They must be released using releaseLocks(lockNames).
If you are working in an End Point,
Parameters
| Name | Type | Description |
|---|---|---|
| lockName | String, required | The name of the lock to acquire. This string is unique and acts as the identifier in further lock related requests |
| timeout | Integer, optional | How often, in seconds, to attempt to retry obtaining the lock |
| id | Integer, optional | If specified, stored alongside the lock for debugging purposes |
| comment | String, optional | If specified, stored alongside the lock for debugging purposes |
Example
let lock = this.callWorkerMethod("formutils", "getLock", {
"lockName": "examplelock",
"timeout": 1
});
