mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-27 00:54:27 +00:00
change sync to async for lockfile debugging
This commit is contained in:
parent
40f4357cd6
commit
6c0665bb49
2 changed files with 12 additions and 8 deletions
|
@ -16,11 +16,13 @@ module.exports = LockManager =
|
|||
stale: @LOCK_STALE
|
||||
Lockfile.lock path, lockOpts, (error) ->
|
||||
return callback new Errors.AlreadyCompilingError("compile in progress") if error?.code is 'EEXIST'
|
||||
if error?
|
||||
logger.err error:error, path:path, statLock:fs.lstatSync(path), statDir: fs.lstatSync(path.dirname(path)), "unable to get lock"
|
||||
return callback(error)
|
||||
runner (error1, args...) ->
|
||||
Lockfile.unlock path, (error2) ->
|
||||
error = error1 or error2
|
||||
return callback(error) if error?
|
||||
callback(null, args...)
|
||||
fs.lstat path, (err, statLock)->
|
||||
fs.lstat Path.dirname(path), (err, statDir)->
|
||||
if error?
|
||||
logger.err error:error, path:path, statLock:statLock, statDir: statDir, "unable to get lock"
|
||||
return callback(error)
|
||||
runner (error1, args...) ->
|
||||
Lockfile.unlock path, (error2) ->
|
||||
error = error1 or error2
|
||||
return callback(error) if error?
|
||||
callback(null, args...)
|
||||
|
|
|
@ -10,6 +10,8 @@ describe "DockerLockManager", ->
|
|||
@LockManager = SandboxedModule.require modulePath, requires:
|
||||
"settings-sharelatex": {}
|
||||
"logger-sharelatex": @logger = { log: sinon.stub(), error: sinon.stub() }
|
||||
"fs":
|
||||
lstat:sinon.stub().callsArgWith(1)
|
||||
"lockfile": @Lockfile = {}
|
||||
@lockFile = "/local/compile/directory/.project-lock"
|
||||
|
||||
|
|
Loading…
Reference in a new issue