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

@mcma/data

Package Overview
Dependencies
Maintainers
3
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mcma/data - npm Package Compare versions

Comparing version 0.13.24 to 0.13.26

1

dist/lib/document-database/document-database-mutex.d.ts
import { Logger } from "@mcma/core";
export interface DocumentDatabaseMutex {
lock(): Promise<void>;
tryLock(): Promise<boolean>;
unlock(): Promise<void>;

@@ -5,0 +6,0 @@ }

@@ -44,2 +44,42 @@ "use strict";

}
async tryLock() {
var _a, _b, _c, _d;
if (this.hasLock) {
throw new core_1.McmaException("Cannot lock when already locked");
}
let tryAgain;
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.debug("Requesting lock for mutex '" + this.mutexName + "' by '" + this.mutexHolder + "'");
do {
tryAgain = false;
try {
await this.putLockData();
const lockData = await this.getLockData();
this.hasLock = (lockData === null || lockData === void 0 ? void 0 : lockData.mutexHolder) === this.mutexHolder && (lockData === null || lockData === void 0 ? void 0 : lockData.versionId) === this.versionId;
}
catch (error) {
const lockData = await this.getLockData();
if (lockData) {
if (lockData.timestamp < Date.now() - this.lockTimeout) {
(_b = this.logger) === null || _b === void 0 ? void 0 : _b.warn("Deleting stale lock for mutex '" + this.mutexName + "' by '" + lockData.mutexHolder + "'");
try {
await this.deleteLockData(lockData.versionId);
}
catch (error) {
}
tryAgain = true;
}
}
}
if (tryAgain) {
await core_1.Utils.sleep(500);
}
} while (tryAgain);
if (this.hasLock) {
(_c = this.logger) === null || _c === void 0 ? void 0 : _c.debug("Acquired lock for mutex '" + this.mutexName + "' by '" + this.mutexHolder + "'");
}
else {
(_d = this.logger) === null || _d === void 0 ? void 0 : _d.debug("Failed to acquire lock for mutex '" + this.mutexName + "' by '" + this.mutexHolder + "'");
}
return this.hasLock;
}
async unlock() {

@@ -46,0 +86,0 @@ var _a;

6

package.json
{
"name": "@mcma/data",
"version": "0.13.24",
"version": "0.13.26",
"description": "Node module with helper utils for dealing with data in the EBU MCMA framework",

@@ -32,6 +32,6 @@ "engines": {

"peerDependencies": {
"@mcma/core": "0.13.24"
"@mcma/core": "0.13.26"
},
"devDependencies": {
"@mcma/core": "0.13.24",
"@mcma/core": "0.13.26",
"@types/node": "^13.7.4",

@@ -38,0 +38,0 @@ "jasmine": "^3.3.1"

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