{"action":"created","issue":{"url":"https://api.github.com/repos/OptimalBits/bull/issues/7","labels_url":"https://api.github.com/repos/OptimalBits/bull/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/OptimalBits/bull/issues/7/comments","events_url":"https://api.github.com/repos/OptimalBits/bull/issues/7/events","html_url":"https://github.com/OptimalBits/bull/issues/7","id":24614649,"number":7,"title":"Delayed jobs","user":{"login":"richthegeek","id":613900,"avatar_url":"https://avatars.githubusercontent.com/u/613900?v=3","gravatar_id":"","url":"https://api.github.com/users/richthegeek","html_url":"https://github.com/richthegeek","followers_url":"https://api.github.com/users/richthegeek/followers","following_url":"https://api.github.com/users/richthegeek/following{/other_user}","gists_url":"https://api.github.com/users/richthegeek/gists{/gist_id}","starred_url":"https://api.github.com/users/richthegeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richthegeek/subscriptions","organizations_url":"https://api.github.com/users/richthegeek/orgs","repos_url":"https://api.github.com/users/richthegeek/repos","events_url":"https://api.github.com/users/richthegeek/events{/privacy}","received_events_url":"https://api.github.com/users/richthegeek/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":29,"created_at":"2013-12-20T10:26:12Z","updated_at":"2015-01-27T23:15:53Z","closed_at":"2015-01-23T08:43:09Z","body":"It's occasionally a requirement for a job to not be done for at least N seconds.\r\n\r\nThere are two obvious API methods for doing this:\r\n1. Addition of \"delay\" to the job options accepted by Queue.add / Job.create\r\n2. Addition of a \"delay\" method to the Job class\r\n\r\n(For Kue, the second option makes sense because Job objects can be used from within their own processor, so failed jobs can have a delay before retrying. With Bull it doesn't make much sense, i think?)\r\n\r\nHow to implement this? Essentially, delayed jobs are put into a ZSET with the score being the time that they should be processed after. Then, the system polls ZRANGEBYSCORE (once Queue.process is called, or once Queue.processDelayed() or something like that is called) from 0 to now, and puts those jobs onto the active queue as before.\r\n\r\nIf you want me to hammer out a PR once we have discussed the API choices a bit then I'd be happy to - something with a bit more care than Kue would be great!\r\n\r\nOf course, it might also be a nice distinct library / extension for bull that can be added distinctly."},"comment":{"url":"https://api.github.com/repos/OptimalBits/bull/issues/comments/71749217","html_url":"https://github.com/OptimalBits/bull/issues/7#issuecomment-71749217","issue_url":"https://api.github.com/repos/OptimalBits/bull/issues/7","id":71749217,"user":{"login":"toddbluhm","id":197282,"avatar_url":"https://avatars.githubusercontent.com/u/197282?v=3","gravatar_id":"","url":"https://api.github.com/users/toddbluhm","html_url":"https://github.com/toddbluhm","followers_url":"https://api.github.com/users/toddbluhm/followers","following_url":"https://api.github.com/users/toddbluhm/following{/other_user}","gists_url":"https://api.github.com/users/toddbluhm/gists{/gist_id}","starred_url":"https://api.github.com/users/toddbluhm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toddbluhm/subscriptions","organizations_url":"https://api.github.com/users/toddbluhm/orgs","repos_url":"https://api.github.com/users/toddbluhm/repos","events_url":"https://api.github.com/users/toddbluhm/events{/privacy}","received_events_url":"https://api.github.com/users/toddbluhm/received_events","type":"User","site_admin":false},"created_at":"2015-01-27T23:15:53Z","updated_at":"2015-01-27T23:15:53Z","body":"Sweet! Thank you so much @manast "}}