Skip to content

Commit 619d1fa

Browse files
committed
fix(MongoInstance): move getting / downloading the binary before creating the launchTimeout
fixes #719
1 parent c4756c4 commit 619d1fa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/mongodb-memory-server-core/src/util/MongoInstance.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ export class MongoInstance extends EventEmitter implements ManagerBase {
345345

346346
let timeout: NodeJS.Timeout;
347347

348+
const mongoBin = await MongoBinary.getPath(this.binaryOpts);
349+
await checkBinaryPermissions(mongoBin);
350+
348351
const launch: Promise<void> = new Promise<void>((res, rej) => {
349352
this.once(MongoInstanceEvents.instanceReady, res);
350353
this.once(MongoInstanceEvents.instanceError, rej);
@@ -369,8 +372,6 @@ export class MongoInstance extends EventEmitter implements ManagerBase {
369372
clearTimeout(timeout);
370373
});
371374

372-
const mongoBin = await MongoBinary.getPath(this.binaryOpts);
373-
await checkBinaryPermissions(mongoBin);
374375
this.debug('start: Starting Processes');
375376
this.mongodProcess = this._launchMongod(mongoBin);
376377
// This assertion is here because somewhere between nodejs 12 and 16 the types for "childprocess.pid" changed to include "| undefined"

0 commit comments

Comments
 (0)