Skip to content

Commit 0d60895

Browse files
committed
fix: Replace lockfile package
1 parent e293efb commit 0d60895

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
"debug": "^2.6.8",
5050
"get-port": "^3.1.0",
5151
"glob": "^7.1.2",
52+
"lockfile": "^1.0.3",
5253
"mkdirp": "^0.5.1",
5354
"mongodb-download": "^2.2.3",
54-
"proper-lockfile": "^2.0.1",
5555
"tmp": "^0.0.31",
5656
"uuid": "^3.0.1"
5757
},

src/util/MongoBinary.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { MongoDBDownload } from 'mongodb-download';
44
import glob from 'glob';
55
import os from 'os';
66
import path from 'path';
7-
import lockFile from 'proper-lockfile';
7+
import LockFile from 'lockfile';
88
import mkdirp from 'mkdirp';
99

1010
export type MongoBinaryCache = {
@@ -54,14 +54,18 @@ export default class MongoBinary {
5454
});
5555
});
5656

57+
const lockfile = path.resolve(downloadDir, `${version}.lock`);
58+
5759
// wait lock
5860
await new Promise((resolve, reject) => {
59-
lockFile.lock(
60-
downloadDir,
61+
LockFile.lock(
62+
lockfile,
6163
{
62-
stale: 120000,
63-
// try to get lock every second, give up after 3 minutes
64-
retries: { retries: 180, factor: 1, minTimeout: 1000 },
64+
wait: 120000,
65+
pollPeriod: 100,
66+
stale: 110000,
67+
retries: 3,
68+
retryWait: 100,
6569
},
6670
err => {
6771
if (err) reject(err);
@@ -86,7 +90,7 @@ export default class MongoBinary {
8690
}
8791

8892
// remove lock
89-
lockFile.unlock(downloadDir, err => {
93+
LockFile.unlock(lockfile, err => {
9094
debug(
9195
err
9296
? `MongoBinary: Error when removing download lock ${err}`

yarn.lock

+4-7
Original file line numberDiff line numberDiff line change
@@ -2727,6 +2727,10 @@ locate-path@^2.0.0:
27272727
p-locate "^2.0.0"
27282728
path-exists "^3.0.0"
27292729

2730+
lockfile@^1.0.3:
2731+
version "1.0.3"
2732+
resolved "https://registry.yarnpkg.com/lockfile/-/lockfile-1.0.3.tgz#2638fc39a0331e9cac1a04b71799931c9c50df79"
2733+
27302734
lodash._baseassign@^3.0.0:
27312735
version "3.2.0"
27322736
resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e"
@@ -3365,13 +3369,6 @@ progress@^1.1.8:
33653369
version "1.1.8"
33663370
resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be"
33673371

3368-
proper-lockfile@^2.0.1:
3369-
version "2.0.1"
3370-
resolved "https://registry.yarnpkg.com/proper-lockfile/-/proper-lockfile-2.0.1.tgz#159fb06193d32003f4b3691dd2ec1a634aa80d1d"
3371-
dependencies:
3372-
graceful-fs "^4.1.2"
3373-
retry "^0.10.0"
3374-
33753372
proto-list@~1.2.1:
33763373
version "1.2.4"
33773374
resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"

0 commit comments

Comments
 (0)