{"action":"opened","number":4,"pull_request":{"url":"https://api.github.com/repos/Shopify/resque-scheduler/pulls/4","id":65830373,"html_url":"https://github.com/Shopify/resque-scheduler/pull/4","diff_url":"https://github.com/Shopify/resque-scheduler/pull/4.diff","patch_url":"https://github.com/Shopify/resque-scheduler/pull/4.patch","issue_url":"https://api.github.com/repos/Shopify/resque-scheduler/issues/4","number":4,"state":"open","locked":false,"title":"[WIP] Race condition when many instances start up concurrently","user":{"login":"hkdsun","id":6955854,"avatar_url":"https://avatars.githubusercontent.com/u/6955854?v=3","gravatar_id":"","url":"https://api.github.com/users/hkdsun","html_url":"https://github.com/hkdsun","followers_url":"https://api.github.com/users/hkdsun/followers","following_url":"https://api.github.com/users/hkdsun/following{/other_user}","gists_url":"https://api.github.com/users/hkdsun/gists{/gist_id}","starred_url":"https://api.github.com/users/hkdsun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hkdsun/subscriptions","organizations_url":"https://api.github.com/users/hkdsun/orgs","repos_url":"https://api.github.com/users/hkdsun/repos","events_url":"https://api.github.com/users/hkdsun/events{/privacy}","received_events_url":"https://api.github.com/users/hkdsun/received_events","type":"User","site_admin":false},"body":"With about 200 instances of resque-scheduler all using the same redis we are constantly the race condition mentioned here: \r\nhttps://github.com/resque/resque-scheduler/blob/master/lib/resque/scheduler/scheduling_extensions.rb#L47-L52\r\n\r\nThe proposed solution is to `SCRIPT` the startup process, so that's what I did. Unit test included.\r\n\r\nWIP since this needs to be polished before it's merged.","created_at":"2016-04-08T18:49:10Z","updated_at":"2016-04-08T18:49:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Shopify/resque-scheduler/pulls/4/commits","review_comments_url":"https://api.github.com/repos/Shopify/resque-scheduler/pulls/4/comments","review_comment_url":"https://api.github.com/repos/Shopify/resque-scheduler/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Shopify/resque-scheduler/issues/4/comments","statuses_url":"https://api.github.com/repos/Shopify/resque-scheduler/statuses/c35214a96c91d6ad7fa4970cc324573077224628","head":{"label":"Shopify:startup-race-condition","ref":"startup-race-condition","sha":"c35214a96c91d6ad7fa4970cc324573077224628","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":54996694,"name":"resque-scheduler","full_name":"Shopify/resque-scheduler","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/resque-scheduler","description":"A light-weight job scheduling system built on top of resque","fork":true,"url":"https://api.github.com/repos/Shopify/resque-scheduler","forks_url":"https://api.github.com/repos/Shopify/resque-scheduler/forks","keys_url":"https://api.github.com/repos/Shopify/resque-scheduler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/resque-scheduler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/resque-scheduler/teams","hooks_url":"https://api.github.com/repos/Shopify/resque-scheduler/hooks","issue_events_url":"https://api.github.com/repos/Shopify/resque-scheduler/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/resque-scheduler/events","assignees_url":"https://api.github.com/repos/Shopify/resque-scheduler/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/resque-scheduler/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/resque-scheduler/tags","blobs_url":"https://api.github.com/repos/Shopify/resque-scheduler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/resque-scheduler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/resque-scheduler/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/resque-scheduler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/resque-scheduler/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/resque-scheduler/languages","stargazers_url":"https://api.github.com/repos/Shopify/resque-scheduler/stargazers","contributors_url":"https://api.github.com/repos/Shopify/resque-scheduler/contributors","subscribers_url":"https://api.github.com/repos/Shopify/resque-scheduler/subscribers","subscription_url":"https://api.github.com/repos/Shopify/resque-scheduler/subscription","commits_url":"https://api.github.com/repos/Shopify/resque-scheduler/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/resque-scheduler/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/resque-scheduler/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/resque-scheduler/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/resque-scheduler/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/resque-scheduler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/resque-scheduler/merges","archive_url":"https://api.github.com/repos/Shopify/resque-scheduler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/resque-scheduler/downloads","issues_url":"https://api.github.com/repos/Shopify/resque-scheduler/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/resque-scheduler/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/resque-scheduler/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/resque-scheduler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/resque-scheduler/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/resque-scheduler/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/resque-scheduler/deployments","created_at":"2016-03-29T17:34:36Z","updated_at":"2016-04-08T15:42:52Z","pushed_at":"2016-04-08T18:45:07Z","git_url":"git://github.com/Shopify/resque-scheduler.git","ssh_url":"git@github.com:Shopify/resque-scheduler.git","clone_url":"https://github.com/Shopify/resque-scheduler.git","svn_url":"https://github.com/Shopify/resque-scheduler","homepage":"","size":956,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"base":{"label":"Shopify:develop","ref":"develop","sha":"1b30cf44c7acb63ebc96199cfb3cb9787dded8ec","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":54996694,"name":"resque-scheduler","full_name":"Shopify/resque-scheduler","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/resque-scheduler","description":"A light-weight job scheduling system built on top of resque","fork":true,"url":"https://api.github.com/repos/Shopify/resque-scheduler","forks_url":"https://api.github.com/repos/Shopify/resque-scheduler/forks","keys_url":"https://api.github.com/repos/Shopify/resque-scheduler/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/resque-scheduler/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/resque-scheduler/teams","hooks_url":"https://api.github.com/repos/Shopify/resque-scheduler/hooks","issue_events_url":"https://api.github.com/repos/Shopify/resque-scheduler/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/resque-scheduler/events","assignees_url":"https://api.github.com/repos/Shopify/resque-scheduler/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/resque-scheduler/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/resque-scheduler/tags","blobs_url":"https://api.github.com/repos/Shopify/resque-scheduler/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/resque-scheduler/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/resque-scheduler/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/resque-scheduler/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/resque-scheduler/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/resque-scheduler/languages","stargazers_url":"https://api.github.com/repos/Shopify/resque-scheduler/stargazers","contributors_url":"https://api.github.com/repos/Shopify/resque-scheduler/contributors","subscribers_url":"https://api.github.com/repos/Shopify/resque-scheduler/subscribers","subscription_url":"https://api.github.com/repos/Shopify/resque-scheduler/subscription","commits_url":"https://api.github.com/repos/Shopify/resque-scheduler/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/resque-scheduler/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/resque-scheduler/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/resque-scheduler/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/resque-scheduler/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/resque-scheduler/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/resque-scheduler/merges","archive_url":"https://api.github.com/repos/Shopify/resque-scheduler/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/resque-scheduler/downloads","issues_url":"https://api.github.com/repos/Shopify/resque-scheduler/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/resque-scheduler/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/resque-scheduler/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/resque-scheduler/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/resque-scheduler/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/resque-scheduler/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/resque-scheduler/deployments","created_at":"2016-03-29T17:34:36Z","updated_at":"2016-04-08T15:42:52Z","pushed_at":"2016-04-08T18:45:07Z","git_url":"git://github.com/Shopify/resque-scheduler.git","ssh_url":"git@github.com:Shopify/resque-scheduler.git","clone_url":"https://github.com/Shopify/resque-scheduler.git","svn_url":"https://github.com/Shopify/resque-scheduler","homepage":"","size":956,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Shopify/resque-scheduler/pulls/4"},"html":{"href":"https://github.com/Shopify/resque-scheduler/pull/4"},"issue":{"href":"https://api.github.com/repos/Shopify/resque-scheduler/issues/4"},"comments":{"href":"https://api.github.com/repos/Shopify/resque-scheduler/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/Shopify/resque-scheduler/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/Shopify/resque-scheduler/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Shopify/resque-scheduler/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/Shopify/resque-scheduler/statuses/c35214a96c91d6ad7fa4970cc324573077224628"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":91,"deletions":27,"changed_files":2}}