mongodb-memory-server-core
Advanced tools
Comparing version 9.2.0 to 9.2.1-beta.1
@@ -45,2 +45,10 @@ "use strict"; | ||
} | ||
// check for the race-condition of "extraction started, but not finished" | ||
// or said differently, the file "exists" but is not fully extracted yet | ||
// see https://github.com/nodkz/mongodb-memory-server/issues/872 | ||
if (returnValue[0] && | ||
(await (0, utils_1.pathExists)((0, utils_1.lockfilePath)(path.dirname(returnValue[1]), useOpts.version)))) { | ||
log('locateBinary: binary found, but also a download-lock, trying to resolve lock'); | ||
return undefined; | ||
} | ||
log(`locateBinary: found binary at "${returnValue[1]}"`); | ||
@@ -47,0 +55,0 @@ this.binaryCache.set(opts.version, returnValue[1]); |
@@ -6,3 +6,2 @@ "use strict"; | ||
const os_1 = tslib_1.__importDefault(require("os")); | ||
const path_1 = tslib_1.__importDefault(require("path")); | ||
const MongoBinaryDownload_1 = tslib_1.__importDefault(require("./MongoBinaryDownload")); | ||
@@ -32,3 +31,3 @@ const resolveConfig_1 = tslib_1.__importStar(require("./resolveConfig")); | ||
/** Lockfile path */ | ||
const lockfile = path_1.default.resolve(downloadDir, `${version}.lock`); | ||
const lockfile = (0, utils_1.lockfilePath)(downloadDir, version); | ||
log(`download: Waiting to acquire Download lock for file "${lockfile}"`); | ||
@@ -35,0 +34,0 @@ // wait to get a lock |
@@ -164,3 +164,10 @@ /// <reference types="node" /> | ||
export declare function md5FromFile(file: string): Promise<string>; | ||
/** | ||
* Helper function to get the lockfile for the provided `version` in `downloadDir` | ||
* @param downloadDir The Download directory of the binary | ||
* @param version The version to be downlaoded | ||
* @returns The lockfile path | ||
*/ | ||
export declare function lockfilePath(downloadDir: string, version: string): string; | ||
export {}; | ||
//# sourceMappingURL=utils.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.md5FromFile = exports.md5 = exports.uuidv4 = exports.removeDir = exports.createTmpDir = exports.mkdir = exports.checkBinaryPermissions = exports.ManagerAdvanced = exports.ManagerBase = exports.tryReleaseFile = exports.pathExists = exports.statPath = exports.authDefault = exports.ensureAsync = exports.isAlive = exports.killProcess = exports.assertion = exports.isNullOrUndefined = exports.uriTemplate = exports.getHost = exports.generateDbName = exports.errorWithCode = void 0; | ||
exports.lockfilePath = exports.md5FromFile = exports.md5 = exports.uuidv4 = exports.removeDir = exports.createTmpDir = exports.mkdir = exports.checkBinaryPermissions = exports.ManagerAdvanced = exports.ManagerBase = exports.tryReleaseFile = exports.pathExists = exports.statPath = exports.authDefault = exports.ensureAsync = exports.isAlive = exports.killProcess = exports.assertion = exports.isNullOrUndefined = exports.uriTemplate = exports.getHost = exports.generateDbName = exports.errorWithCode = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -311,2 +311,12 @@ const debug_1 = tslib_1.__importDefault(require("debug")); | ||
exports.md5FromFile = md5FromFile; | ||
/** | ||
* Helper function to get the lockfile for the provided `version` in `downloadDir` | ||
* @param downloadDir The Download directory of the binary | ||
* @param version The version to be downlaoded | ||
* @returns The lockfile path | ||
*/ | ||
function lockfilePath(downloadDir, version) { | ||
return path.resolve(downloadDir, `${version}.lock`); | ||
} | ||
exports.lockfilePath = lockfilePath; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "mongodb-memory-server-core", | ||
"version": "9.2.0", | ||
"version": "9.2.1-beta.1", | ||
"description": "MongoDB Server for testing (core package, without autodownload). The server will allow you to connect your favourite ODM or client library to the MongoDB Server and run parallel integration tests isolated from each other.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
386836
5685
1