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

Have keep alive option when get the file lock #12

Open
scaret opened this issue Sep 4, 2014 · 8 comments
Open

Have keep alive option when get the file lock #12

scaret opened this issue Sep 4, 2014 · 8 comments

Comments

@scaret
Copy link

scaret commented Sep 4, 2014

If A get the file lock for quite a long time, A should always touch the file to make sure the lock is not stale

@isaacs
Copy link
Contributor

isaacs commented Aug 4, 2015

+1 patch welcome. Should use the touch module.

@jonathon-love
Copy link

hi,
i was going to write this patch, but i notice that at lines 10-12 of lockfile.js has platform specific code:

var os = require('os')
exports.filetime = 'ctime'
if (os.platform() == "win32") {
  exports.filetime = 'mtime'
}

it would appear that under windows, you check modification time, whereas everywhere else, you use creation time. why doesn't it use modification time everywhere? this will make _touch_ing the file easier.

with thanks

@isaacs
Copy link
Contributor

isaacs commented Jan 17, 2016

@jonathon-love

On windows, ctime is "created time".

On posix systems, ctime is "changed time". That is, the last time any file attribute (including atime) was changed. Since atime changes ctime, any modification is an access, it's more like Windows' modified-time or mtime.

@jonathon-love
Copy link

chuckles ... righto.

@jonathon-love
Copy link

what should we call this function?

renew()
renewLock()
touch()

i don't think touch() is good, because it requires you to be familiar with the touch command.

@evan-king
Copy link

I would suggest refresh(). renew() works too. Adding Lock on the end would be redundant anywhere the library reference variable is appropriately named.

@ORESoftware
Copy link
Contributor

I'm touching this thread to make sure it's not stale

@jonathon-love
Copy link

i think it might be stale :P

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants