Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Commit

Permalink
fix: removing staleness in lock
Browse files Browse the repository at this point in the history
  • Loading branch information
AuHau committed Oct 22, 2019
1 parent 1474d5e commit e92d057
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/repo/lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@ const { lock } = require('proper-lockfile')
const log = debug('repo-migrations:repo_fs_lock')
const lockFile = 'repo.lock'

/**
* Duration in milliseconds in which the lock is considered stale
* @see https://github.com/moxystudio/node-proper-lockfile#lockfile-options
* The default value of 10000 was too low for ipfs and sometimes `proper-lockfile`
* would throw an exception because it couldn't update the lock file mtime within
* the 10s threshold. @see https://github.com/ipfs/js-ipfs-repo/pull/182
* Increasing to 20s is a temporary fix a permanent fix should be implemented in
* the future.
*/
const STALE_TIME = 20000

/**
* Lock the repo in the given dir and given repo's version.
*
Expand All @@ -28,7 +17,7 @@ const STALE_TIME = 20000
exports.lock = async (version, dir) => {
const file = path.join(dir, lockFile)
log('locking %s', file)
const release = await lock(dir, { lockfilePath: file, stale: STALE_TIME })
const release = await lock(dir, { lockfilePath: file })
return {
close: () => {
log('releasing lock %s', file)
Expand Down

0 comments on commit e92d057

Please sign in to comment.