{"action":"created","issue":{"url":"https://api.github.com/repos/burtonator/polar-bookshelf/issues/164","repository_url":"https://api.github.com/repos/burtonator/polar-bookshelf","labels_url":"https://api.github.com/repos/burtonator/polar-bookshelf/issues/164/labels{/name}","comments_url":"https://api.github.com/repos/burtonator/polar-bookshelf/issues/164/comments","events_url":"https://api.github.com/repos/burtonator/polar-bookshelf/issues/164/events","html_url":"https://github.com/burtonator/polar-bookshelf/issues/164","id":359933447,"node_id":"MDU6SXNzdWUzNTk5MzM0NDc=","number":164,"title":"Polar still seems to have a race where it corrupts files.","user":{"login":"burtonator","id":45447,"node_id":"MDQ6VXNlcjQ1NDQ3","avatar_url":"https://avatars3.githubusercontent.com/u/45447?v=4","gravatar_id":"","url":"https://api.github.com/users/burtonator","html_url":"https://github.com/burtonator","followers_url":"https://api.github.com/users/burtonator/followers","following_url":"https://api.github.com/users/burtonator/following{/other_user}","gists_url":"https://api.github.com/users/burtonator/gists{/gist_id}","starred_url":"https://api.github.com/users/burtonator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burtonator/subscriptions","organizations_url":"https://api.github.com/users/burtonator/orgs","repos_url":"https://api.github.com/users/burtonator/repos","events_url":"https://api.github.com/users/burtonator/events{/privacy}","received_events_url":"https://api.github.com/users/burtonator/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-09-13T14:55:19Z","updated_at":"2018-09-13T15:37:24Z","closed_at":null,"author_association":"OWNER","body":"Maybe move to an optimistic locking system for now or decouple DocInfo from the main DocMeta file.\r\n\r\nThe repository would write DocInfo and the main viewer app would write out DocMeta.\r\n\r\nI think this second strategy would be easier to implement and more productive.  "},"comment":{"url":"https://api.github.com/repos/burtonator/polar-bookshelf/issues/comments/421051635","html_url":"https://github.com/burtonator/polar-bookshelf/issues/164#issuecomment-421051635","issue_url":"https://api.github.com/repos/burtonator/polar-bookshelf/issues/164","id":421051635,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMTA1MTYzNQ==","user":{"login":"burtonator","id":45447,"node_id":"MDQ6VXNlcjQ1NDQ3","avatar_url":"https://avatars3.githubusercontent.com/u/45447?v=4","gravatar_id":"","url":"https://api.github.com/users/burtonator","html_url":"https://github.com/burtonator","followers_url":"https://api.github.com/users/burtonator/followers","following_url":"https://api.github.com/users/burtonator/following{/other_user}","gists_url":"https://api.github.com/users/burtonator/gists{/gist_id}","starred_url":"https://api.github.com/users/burtonator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burtonator/subscriptions","organizations_url":"https://api.github.com/users/burtonator/orgs","repos_url":"https://api.github.com/users/burtonator/repos","events_url":"https://api.github.com/users/burtonator/events{/privacy}","received_events_url":"https://api.github.com/users/burtonator/received_events","type":"User","site_admin":false},"created_at":"2018-09-13T15:37:24Z","updated_at":"2018-09-13T15:37:24Z","author_association":"OWNER","body":"Lock file design:\r\n\r\n- determine the main pid by calling:\r\n```process.pid`` in the main proc and ```require('electron').remote.process.pid``` in the renderer.  this is used if a process crashes and leaves a lock file open.\r\n\r\n- create the file but only if it does not exist:\r\n\r\nhttps://stackoverflow.com/questions/12899061/creating-a-file-only-if-it-doesnt-exist-in-node-js\r\n\r\n- if it DOES exist , but is the wrong pid, remove it, and retry.\r\n\r\n- if we can't acquire the lock , add a notifier on the file, and retry. We could also add a setTimeout to avoid using watcher (which might have OS problems) and sleep for a random amount of time.  \r\n\r\n... another idea could be to write multiple versions ... and then the last writer wins.  \r\n"}}
{"actor":{"display_login":"burtonator"}}