Skip to content

Commit

Permalink
fix(MongoInstance): move getting / downloading the binary before crea…
Browse files Browse the repository at this point in the history
…ting the launchTimeout

fixes #719
  • Loading branch information
hasezoey committed Nov 25, 2022
1 parent c4756c4 commit 619d1fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/mongodb-memory-server-core/src/util/MongoInstance.ts
Expand Up @@ -345,6 +345,9 @@ export class MongoInstance extends EventEmitter implements ManagerBase {

let timeout: NodeJS.Timeout;

const mongoBin = await MongoBinary.getPath(this.binaryOpts);
await checkBinaryPermissions(mongoBin);

const launch: Promise<void> = new Promise<void>((res, rej) => {
this.once(MongoInstanceEvents.instanceReady, res);
this.once(MongoInstanceEvents.instanceError, rej);
Expand All @@ -369,8 +372,6 @@ export class MongoInstance extends EventEmitter implements ManagerBase {
clearTimeout(timeout);
});

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

0 comments on commit 619d1fa

Please sign in to comment.