Skip to content

Commit

Permalink
fix(MongoBinary): change "LockFile.unlock" to be async
Browse files Browse the repository at this point in the history
- change "LockFile.unlock" to finish before returning
  • Loading branch information
hasezoey committed Sep 13, 2020
1 parent 39ca575 commit 87c7b33
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/mongodb-memory-server-core/src/util/MongoBinary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,15 @@ export default class MongoBinary {
this.cache[version] = await downloader.getMongodPath();
}
// remove lock
LockFile.unlock(lockfile, (err) => {
log(
err
? `MongoBinary: Error when removing download lock ${err}`
: `MongoBinary: Download lock removed`
);
await new Promise((res) => {
LockFile.unlock(lockfile, (err) => {
log(
err
? `MongoBinary: Error when removing download lock ${err}`
: `MongoBinary: Download lock removed`
);
res(); // we dont care if it was successful or not
});
});
return this.getCachePath(version);
}
Expand Down

0 comments on commit 87c7b33

Please sign in to comment.