{"action":"created","issue":{"url":"https://api.github.com/repos/rightscale/scheduled_job/issues/20","labels_url":"https://api.github.com/repos/rightscale/scheduled_job/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/rightscale/scheduled_job/issues/20/comments","events_url":"https://api.github.com/repos/rightscale/scheduled_job/issues/20/events","html_url":"https://github.com/rightscale/scheduled_job/issues/20","id":56018637,"number":20,"title":"Provide a rake task to re-schedule all scheduled jobs","user":{"login":"alikhajeh1","id":638577,"avatar_url":"https://avatars.githubusercontent.com/u/638577?v=3","gravatar_id":"","url":"https://api.github.com/users/alikhajeh1","html_url":"https://github.com/alikhajeh1","followers_url":"https://api.github.com/users/alikhajeh1/followers","following_url":"https://api.github.com/users/alikhajeh1/following{/other_user}","gists_url":"https://api.github.com/users/alikhajeh1/gists{/gist_id}","starred_url":"https://api.github.com/users/alikhajeh1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alikhajeh1/subscriptions","organizations_url":"https://api.github.com/users/alikhajeh1/orgs","repos_url":"https://api.github.com/users/alikhajeh1/repos","events_url":"https://api.github.com/users/alikhajeh1/events{/privacy}","received_events_url":"https://api.github.com/users/alikhajeh1/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rightscale/scheduled_job/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-30T10:43:34Z","updated_at":"2015-01-31T20:47:49Z","closed_at":null,"body":"We currently use this gem in a few repos, and in every one of those repos, we've added our own rake task that's used to \"kick-off\" the jobs by calling `.schedule_job` on them. It might be possible do to look for all classes that include ScheduledJob and make this rake task part of the gem.\r\n```\r\nnamespace :jobs do\r\n  task :reschedule => :environment do\r\n    all_jobs.each { |job| job.schedule_job }\r\n  end\r\n```"},"comment":{"url":"https://api.github.com/repos/rightscale/scheduled_job/issues/comments/72335895","html_url":"https://github.com/rightscale/scheduled_job/issues/20#issuecomment-72335895","issue_url":"https://api.github.com/repos/rightscale/scheduled_job/issues/20","id":72335895,"user":{"login":"CallumD","id":1051292,"avatar_url":"https://avatars.githubusercontent.com/u/1051292?v=3","gravatar_id":"","url":"https://api.github.com/users/CallumD","html_url":"https://github.com/CallumD","followers_url":"https://api.github.com/users/CallumD/followers","following_url":"https://api.github.com/users/CallumD/following{/other_user}","gists_url":"https://api.github.com/users/CallumD/gists{/gist_id}","starred_url":"https://api.github.com/users/CallumD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CallumD/subscriptions","organizations_url":"https://api.github.com/users/CallumD/orgs","repos_url":"https://api.github.com/users/CallumD/repos","events_url":"https://api.github.com/users/CallumD/events{/privacy}","received_events_url":"https://api.github.com/users/CallumD/received_events","type":"User","site_admin":false},"created_at":"2015-01-31T20:47:49Z","updated_at":"2015-01-31T20:47:49Z","body":"I have something working for this. There a couple of issues that came up which I have had to work around.\r\n\r\nSometimes we include scheduled job in a parent class then inherit in the child classes. I was able to work around this by scheduling classes that have the module included and respond to time_to_recur or are descendants of that job. This would be fine however we need to ensure then that each of the children define there own time_to_recur. Not sure if its just better forcing them to include the module.\r\n\r\nSecondly we will have no control over which jobs are not included when the reschedule is performed. Essentially anything that included scheduled_job will get scheduled where as at the moment we use the all jobs array to control which gets scheduled. Again we could add some method or constant to control this. I will put in a PR for where I have got to and reference this issue."}}