New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sesamecare-oss/redlock

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sesamecare-oss/redlock - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

3

build/index.d.ts

@@ -50,3 +50,4 @@ /// <reference types="node" />

expiration: number;
constructor(redlock: Redlock, resources: string[], value: string, attempts: ReadonlyArray<Promise<ExecutionStats>>, expiration: number);
readonly settings?: Partial<Settings> | undefined;
constructor(redlock: Redlock, resources: string[], value: string, attempts: ReadonlyArray<Promise<ExecutionStats>>, expiration: number, settings?: Partial<Settings> | undefined);
release(): Promise<ExecutionResult>;

@@ -53,0 +54,0 @@ extend(duration: number): Promise<Lock>;

@@ -56,3 +56,4 @@ "use strict";

expiration;
constructor(redlock, resources, value, attempts, expiration) {
settings;
constructor(redlock, resources, value, attempts, expiration, settings) {
this.redlock = redlock;

@@ -63,2 +64,3 @@ this.resources = resources;

this.expiration = expiration;
this.settings = settings;
}

@@ -69,3 +71,3 @@ async release() {

async extend(duration) {
return this.redlock.extend(this, duration);
return this.redlock.extend(this, duration, this.settings);
}

@@ -157,3 +159,3 @@ }

const drift = Math.round((settings?.driftFactor ?? this.settings.driftFactor) * duration) + 2;
return new Lock(this, resources, value, attempts, start + duration - drift);
return new Lock(this, resources, value, attempts, start + duration - drift, settings);
}

@@ -201,3 +203,3 @@ catch (error) {

const drift = Math.round((settings?.driftFactor ?? this.settings.driftFactor) * duration) + 2;
return new Lock(this, existing.resources, existing.value, attempts, start + duration - drift);
return new Lock(this, existing.resources, existing.value, attempts, start + duration - drift, settings);
}

@@ -204,0 +206,0 @@ /**

{
"name": "@sesamecare-oss/redlock",
"version": "1.3.1",
"version": "1.4.0",
"description": "A modern node.js redlock implementation for distributed redis locks",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -105,2 +105,3 @@ import { randomBytes, createHash } from 'crypto';

public expiration: number,
public readonly settings?: Partial<Settings>,
) {}

@@ -113,3 +114,3 @@

async extend(duration: number): Promise<Lock> {
return this.redlock.extend(this, duration);
return this.redlock.extend(this, duration, this.settings);
}

@@ -236,3 +237,3 @@ }

return new Lock(this, resources, value, attempts, start + duration - drift);
return new Lock(this, resources, value, attempts, start + duration - drift, settings);
} catch (error) {

@@ -297,3 +298,3 @@ // If there was an error acquiring the lock, release any partial lock

return new Lock(this, existing.resources, existing.value, attempts, start + duration - drift);
return new Lock(this, existing.resources, existing.value, attempts, start + duration - drift, settings);
}

@@ -300,0 +301,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc