{"action":"created","issue":{"url":"https://api.github.com/repos/fstech/delayed_job_active_record/issues/2","repository_url":"https://api.github.com/repos/fstech/delayed_job_active_record","labels_url":"https://api.github.com/repos/fstech/delayed_job_active_record/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/fstech/delayed_job_active_record/issues/2/comments","events_url":"https://api.github.com/repos/fstech/delayed_job_active_record/issues/2/events","html_url":"https://github.com/fstech/delayed_job_active_record/pull/2","id":175497008,"number":2,"title":"Dont use locked_by when looking for job","user":{"login":"piotrj","id":9296,"avatar_url":"https://avatars.githubusercontent.com/u/9296?v=3","gravatar_id":"","url":"https://api.github.com/users/piotrj","html_url":"https://github.com/piotrj","followers_url":"https://api.github.com/users/piotrj/followers","following_url":"https://api.github.com/users/piotrj/following{/other_user}","gists_url":"https://api.github.com/users/piotrj/gists{/gist_id}","starred_url":"https://api.github.com/users/piotrj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piotrj/subscriptions","organizations_url":"https://api.github.com/users/piotrj/orgs","repos_url":"https://api.github.com/users/piotrj/repos","events_url":"https://api.github.com/users/piotrj/events{/privacy}","received_events_url":"https://api.github.com/users/piotrj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-09-07T13:03:43Z","updated_at":"2016-09-22T07:59:52Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/fstech/delayed_job_active_record/pulls/2","html_url":"https://github.com/fstech/delayed_job_active_record/pull/2","diff_url":"https://github.com/fstech/delayed_job_active_record/pull/2.diff","patch_url":"https://github.com/fstech/delayed_job_active_record/pull/2.patch"},"body":"Locked by check is used in cases when the worker dies and then it comes\r\nback to life. Then we would want it to pick up the job he dropped when\r\ndying. In our case we don't name our workers and the default is\r\nhost:pid. When the worker dies it is spawn again but its pid will be\r\ndifferent. So there is no (or very little) chance that we will have\r\nworker with the same name. So there is no point for checking for it.\r\nMoreover this check breaks usage of any index we could think of.\r\nIt's better for the job to time out and being picked up by another\r\nworker.\r\n\r\nMoreover this commit introduces better index for our use case of\r\nDelayed::Job.\r\n\r\n@karol-nowak @schiza @szymzet @iaintshine what do you guys think?\r\nI put queue at the and of the index as sometimes we have workers without queue specified (which used to break our DJs and made it very slow with lot of jobs in DB for example notificatus and uploader).\r\n\r\nFrom my very simple tests it seems that we could go from hundreds of ms to fraction of ms on reserve job query ;) "},"comment":{"url":"https://api.github.com/repos/fstech/delayed_job_active_record/issues/comments/248836802","html_url":"https://github.com/fstech/delayed_job_active_record/pull/2#issuecomment-248836802","issue_url":"https://api.github.com/repos/fstech/delayed_job_active_record/issues/2","id":248836802,"user":{"login":"piotrj","id":9296,"avatar_url":"https://avatars.githubusercontent.com/u/9296?v=3","gravatar_id":"","url":"https://api.github.com/users/piotrj","html_url":"https://github.com/piotrj","followers_url":"https://api.github.com/users/piotrj/followers","following_url":"https://api.github.com/users/piotrj/following{/other_user}","gists_url":"https://api.github.com/users/piotrj/gists{/gist_id}","starred_url":"https://api.github.com/users/piotrj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piotrj/subscriptions","organizations_url":"https://api.github.com/users/piotrj/orgs","repos_url":"https://api.github.com/users/piotrj/repos","events_url":"https://api.github.com/users/piotrj/events{/privacy}","received_events_url":"https://api.github.com/users/piotrj/received_events","type":"User","site_admin":false},"created_at":"2016-09-22T07:59:52Z","updated_at":"2016-09-22T07:59:52Z","body":"So I brought it back in uploader and has been runnning in production for a couple of days now (deployed around 9:30 on Sep 20)\r\n\r\nResults:\r\n\r\nNR Delayed Job select query time: \r\n![screen shot 2016-09-22 at 09 43 32](https://cloud.githubusercontent.com/assets/9296/18740268/254522d4-80a9-11e6-8f13-f22164ba7d99.png)\r\n\r\nAverage time spent reserving job:\r\n![screen shot 2016-09-22 at 09 46 49](https://cloud.githubusercontent.com/assets/9296/18740341/8ab5cb46-80a9-11e6-8d27-675fe3c2bf24.png)\r\n\r\nSlow logs from uploader DB:\r\n![screen shot 2016-09-22 at 09 52 35](https://cloud.githubusercontent.com/assets/9296/18740553/8b6c28cc-80aa-11e6-9c51-01313c9bd186.png)\r\n\r\nI'm merging this Pull Request. If anyone of you wants to try in their service I would love to know results. \r\n\r\nIf anyone is interested in getting the time spent in reservation metric you can do it like this:\r\nhttps://github.com/fstech/uploader/blob/master/config/initializers/delayed_jobs.rb#L1-L33\r\nProbably will move it to some gem at some point. \r\n\r\n"}}
{"actor":{"display_login":"piotrj"}}