{"action":"created","issue":{"url":"https://api.github.com/repos/rsnapshot/rsnapshot/issues/57","labels_url":"https://api.github.com/repos/rsnapshot/rsnapshot/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/rsnapshot/rsnapshot/issues/57/comments","events_url":"https://api.github.com/repos/rsnapshot/rsnapshot/issues/57/events","html_url":"https://github.com/rsnapshot/rsnapshot/pull/57","id":62032839,"number":57,"title":"wait_for_lock option","user":{"login":"multi-io","id":283179,"avatar_url":"https://avatars.githubusercontent.com/u/283179?v=3","gravatar_id":"","url":"https://api.github.com/users/multi-io","html_url":"https://github.com/multi-io","followers_url":"https://api.github.com/users/multi-io/followers","following_url":"https://api.github.com/users/multi-io/following{/other_user}","gists_url":"https://api.github.com/users/multi-io/gists{/gist_id}","starred_url":"https://api.github.com/users/multi-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/multi-io/subscriptions","organizations_url":"https://api.github.com/users/multi-io/orgs","repos_url":"https://api.github.com/users/multi-io/repos","events_url":"https://api.github.com/users/multi-io/events{/privacy}","received_events_url":"https://api.github.com/users/multi-io/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-16T10:05:52Z","updated_at":"2015-03-18T00:05:41Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rsnapshot/rsnapshot/pulls/57","html_url":"https://github.com/rsnapshot/rsnapshot/pull/57","diff_url":"https://github.com/rsnapshot/rsnapshot/pull/57.diff","patch_url":"https://github.com/rsnapshot/rsnapshot/pull/57.patch"},"body":"This is a flag that causes rsnapshot to wait (loop and keep trying) until the lockfile can be created, rather than bailing out immediately if it can't."},"comment":{"url":"https://api.github.com/repos/rsnapshot/rsnapshot/issues/comments/82648057","html_url":"https://github.com/rsnapshot/rsnapshot/pull/57#issuecomment-82648057","issue_url":"https://api.github.com/repos/rsnapshot/rsnapshot/issues/57","id":82648057,"user":{"login":"multi-io","id":283179,"avatar_url":"https://avatars.githubusercontent.com/u/283179?v=3","gravatar_id":"","url":"https://api.github.com/users/multi-io","html_url":"https://github.com/multi-io","followers_url":"https://api.github.com/users/multi-io/followers","following_url":"https://api.github.com/users/multi-io/following{/other_user}","gists_url":"https://api.github.com/users/multi-io/gists{/gist_id}","starred_url":"https://api.github.com/users/multi-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/multi-io/subscriptions","organizations_url":"https://api.github.com/users/multi-io/orgs","repos_url":"https://api.github.com/users/multi-io/repos","events_url":"https://api.github.com/users/multi-io/events{/privacy}","received_events_url":"https://api.github.com/users/multi-io/received_events","type":"User","site_admin":false},"created_at":"2015-03-18T00:05:41Z","updated_at":"2015-03-18T00:05:41Z","body":"A loop may not be pretty, but I'm afraid it's the only way to achieve this as long as you want to stick with the open/O_EXCL|O_CREAT approach. If you want a blocking solution, I guess you'd have to switch to a permanent lock file and flock(). That might actually be preferable, as the current open/O_EXCL-based implementation in combination with the stale lockfile check contains races that I think are unavoidable. I can write an flock()-based implementation if that's OK.\r\n\r\nThe optional argument to add_lockfile was in there so callers can reduce (to zero, potentially) the time between tries to acquire the lock. This was meant for unit tests primarily (I have written one in another branch of my fork, and it actually triggers the races, which is why I didn't commit it)."}}