File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -5,9 +5,19 @@ const debug = require('debug')
5
5
const { lock } = require ( 'proper-lockfile' )
6
6
7
7
const log = debug ( 'repo:lock' )
8
-
9
8
const lockFile = 'repo.lock'
10
9
10
+ /**
11
+ * Duration in milliseconds in which the lock is considered stale
12
+ * @see https://github.com/moxystudio/node-proper-lockfile#lockfile-options
13
+ * The default value of 10000 was too low for ipfs and sometimes `proper-lockfile`
14
+ * would throw an exception because it couldn't update the lock file mtime within
15
+ * the 10s threshold. @see https://github.com/ipfs/js-ipfs-repo/pull/182
16
+ * Increasing to 20s is a temporary fix a permanent fix should be implemented in
17
+ * the future.
18
+ */
19
+ const STALE_TIME = 20000
20
+
11
21
/**
12
22
* Lock the repo in the given dir.
13
23
*
@@ -19,7 +29,7 @@ exports.lock = (dir, callback) => {
19
29
const file = path . join ( dir , lockFile )
20
30
log ( 'locking %s' , file )
21
31
22
- lock ( dir , { lockfilePath : file } )
32
+ lock ( dir , { lockfilePath : file , stale : STALE_TIME } )
23
33
. then ( release => {
24
34
callback ( null , { close : ( cb ) => {
25
35
release ( )
You can’t perform that action at this time.
0 commit comments