mongodb-memory-server-core
Advanced tools
Comparing version 5.1.5 to 5.1.8
@@ -6,2 +6,13 @@ # Change Log | ||
## [5.1.8](https://github.com/nodkz/mongodb-memory-server/compare/v5.1.7...v5.1.8) (2019-07-23) | ||
### Bug Fixes | ||
* wait until primary is transitioned from secondary for replicaSet ([596fed8](https://github.com/nodkz/mongodb-memory-server/commit/596fed8)) | ||
## [5.1.5](https://github.com/nodkz/mongodb-memory-server/compare/v5.1.4...v5.1.5) (2019-06-18) | ||
@@ -8,0 +19,0 @@ |
@@ -213,8 +213,8 @@ "use strict"; | ||
} | ||
this.servers = servers; | ||
// Brief delay to wait for servers to start up. | ||
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 1000); })]; | ||
// ensures all servers are listening for connection | ||
return [4 /*yield*/, Promise.all(servers.map(function (s) { return s.start(); }))]; | ||
case 1: | ||
// Brief delay to wait for servers to start up. | ||
// ensures all servers are listening for connection | ||
_a.sent(); | ||
this.servers = servers; | ||
return [4 /*yield*/, this._initReplSet()]; | ||
@@ -332,3 +332,3 @@ case 2: | ||
var serverOpts = { | ||
autoStart: true, | ||
autoStart: false, | ||
debug: this.opts.debug, | ||
@@ -352,10 +352,14 @@ binary: this.opts.binary, | ||
} | ||
return [4 /*yield*/, this.admin.command({ replSetGetStatus: 1 })]; | ||
return [4 /*yield*/, this.admin.command({ | ||
serverStatus: 1, | ||
metrics: 0, | ||
locks: 0, | ||
})]; | ||
case 1: | ||
replStatus = _a.sent(); | ||
this.debug(' replStatus:', replStatus); | ||
hasPrimary = replStatus.members.some(function (m) { return m.stateStr === 'PRIMARY'; }); | ||
hasPrimary = replStatus.repl.ismaster; | ||
if (!hasPrimary) { | ||
this.debug('No PRIMARY yet. Waiting...'); | ||
return [2 /*return*/, new Promise(function (resolve) { return setTimeout(function () { return resolve(_this._waitForPrimary()); }, 1000); })]; | ||
return [2 /*return*/, new Promise(function (resolve) { return setTimeout(function () { return resolve(_this._waitForPrimary()); }, 500); })]; | ||
} | ||
@@ -362,0 +366,0 @@ return [2 /*return*/, true]; |
@@ -26,14 +26,8 @@ export declare type DebugFn = (...args: any[]) => any; | ||
} | ||
export interface ReplStatusMemberT { | ||
_id: number; | ||
name: string; | ||
health: number; | ||
state: number; | ||
stateStr: string; | ||
uptime: number; | ||
export interface ReplStatusReplT { | ||
ismaster: boolean; | ||
} | ||
export interface ReplStatusResultT { | ||
set: string; | ||
members: ReplStatusMemberT[]; | ||
repl: ReplStatusReplT; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "mongodb-memory-server-core", | ||
"version": "5.1.5", | ||
"version": "5.1.8", | ||
"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.", | ||
@@ -56,3 +56,3 @@ "main": "lib/index", | ||
}, | ||
"gitHead": "35f755b0eac38510088d7bfb6b525a27f47e5ef3" | ||
"gitHead": "f7487884f34e84a9790d15065b42e09776f56613" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
162868
2239