Skip to content

Commit 5138813

Browse files
arath17Ashutosh Rath
andauthored
Use start returned from _attemptOperation in extend() (#276)
* Fix extension failure * format * Use start returned from _attemptOperation in extend() for calculating expiration time --------- Co-authored-by: Ashutosh Rath <arath9@its.jnj.com>
1 parent 06d9f5c commit 5138813

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,12 @@ export default class Redlock extends EventEmitter {
375375
throw new Error("Duration must be an integer value in milliseconds.");
376376
}
377377

378-
const start = Date.now();
379-
380378
// The lock has already expired.
381379
if (existing.expiration < Date.now()) {
382380
throw new ExecutionError("Cannot extend an already-expired lock.", []);
383381
}
384382

385-
const { attempts } = await this._execute(
383+
const { attempts, start } = await this._execute(
386384
this.scripts.extendScript,
387385
existing.resources,
388386
[existing.value, duration],

0 commit comments

Comments
 (0)