{"action":"created","comment":{"url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/pulls/comments/210183653","pull_request_review_id":146344860,"id":210183653,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMDE4MzY1Mw==","diff_hunk":"@@ -56,21 +56,23 @@ def enque! time = Time.now.utc\n               nil\n             end\n \n-        if klass_const\n-          if defined?(ActiveJob::Base) && klass_const < ActiveJob::Base\n-            enqueue_active_job(klass_const)\n-          else\n-            enqueue_sidekiq_worker(klass_const)\n-          end\n-        else\n-          if @active_job\n-            Sidekiq::Client.push(active_job_message)\n+        jid =","path":"lib/sidekiq/cron/job.rb","position":13,"original_position":13,"commit_id":"f00c2116e272891a815f2c77382235e1dac589b4","original_commit_id":"f00c2116e272891a815f2c77382235e1dac589b4","user":{"login":"ondrejbartas","id":45809,"node_id":"MDQ6VXNlcjQ1ODA5","avatar_url":"https://avatars0.githubusercontent.com/u/45809?v=4","gravatar_id":"","url":"https://api.github.com/users/ondrejbartas","html_url":"https://github.com/ondrejbartas","followers_url":"https://api.github.com/users/ondrejbartas/followers","following_url":"https://api.github.com/users/ondrejbartas/following{/other_user}","gists_url":"https://api.github.com/users/ondrejbartas/gists{/gist_id}","starred_url":"https://api.github.com/users/ondrejbartas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ondrejbartas/subscriptions","organizations_url":"https://api.github.com/users/ondrejbartas/orgs","repos_url":"https://api.github.com/users/ondrejbartas/repos","events_url":"https://api.github.com/users/ondrejbartas/events{/privacy}","received_events_url":"https://api.github.com/users/ondrejbartas/received_events","type":"User","site_admin":false},"body":"you are setting `jid = ` and then in every branch of condition you are doing the same.\r\n\r\nif this it the case then why not to make method \r\n\r\n```ruby\r\ndef enqueue_job_based_on_type\r\n         klass_const =\r\n             begin\r\n               Sidekiq::Cron::Support.constantize(@klass.to_s)\r\n             rescue NameError\r\n               nil\r\n             end\r\n  if klass_const\r\n            if defined?(ActiveJob::Base) && klass_const < ActiveJob::Base\r\n              enqueue_active_job(klass_const).try :provider_job_id\r\n            else\r\n              enqueue_sidekiq_worker(klass_const)\r\n            end\r\n          else\r\n            if @active_job\r\n              Sidekiq::Client.push(active_job_message)\r\n            else\r\n              Sidekiq::Client.push(sidekiq_worker_message)\r\n            end\r\n          end\r\nend\r\n```\r\nand then just do `jid = enqueue_job_based_on_type`\r\n","created_at":"2018-08-15T06:49:58Z","updated_at":"2018-08-15T06:49:58Z","html_url":"https://github.com/ondrejbartas/sidekiq-cron/pull/211#discussion_r210183653","pull_request_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/pulls/211","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/pulls/comments/210183653"},"html":{"href":"https://github.com/ondrejbartas/sidekiq-cron/pull/211#discussion_r210183653"},"pull_request":{"href":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/pulls/211"}}},"pull_request":{"url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/pulls/211","id":201910900,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxOTEwOTAw","html_url":"https://github.com/ondrejbartas/sidekiq-cron/pull/211","diff_url":"https://github.com/ondrejbartas/sidekiq-cron/pull/211.diff","patch_url":"https://github.com/ondrejbartas/sidekiq-cron/pull/211.patch","issue_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/issues/211","number":211,"state":"open","locked":false,"title":"Added jid history, just like Sidekiq Enterprise","user":{"login":"Akhilesh05","id":2811408,"node_id":"MDQ6VXNlcjI4MTE0MDg=","avatar_url":"https://avatars1.githubusercontent.com/u/2811408?v=4","gravatar_id":"","url":"https://api.github.com/users/Akhilesh05","html_url":"https://github.com/Akhilesh05","followers_url":"https://api.github.com/users/Akhilesh05/followers","following_url":"https://api.github.com/users/Akhilesh05/following{/other_user}","gists_url":"https://api.github.com/users/Akhilesh05/gists{/gist_id}","starred_url":"https://api.github.com/users/Akhilesh05/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Akhilesh05/subscriptions","organizations_url":"https://api.github.com/users/Akhilesh05/orgs","repos_url":"https://api.github.com/users/Akhilesh05/repos","events_url":"https://api.github.com/users/Akhilesh05/events{/privacy}","received_events_url":"https://api.github.com/users/Akhilesh05/received_events","type":"User","site_admin":false},"body":"I have added the enqueue time/jid history for the cron jobs. This feature is also present in _Sidekiq Ent_.\r\nThis will be quite a useful feature.\r\nThe default history size will be 10. User can also change it by adding `:cron_history_size` in their `sidekiq.yml` file.\r\n\r\n**Have a look:**\r\n![image](https://user-images.githubusercontent.com/2811408/42814798-6d387540-89d6-11e8-8766-fd9ef7f8fe9c.png)\r\n","created_at":"2018-07-17T11:33:40Z","updated_at":"2018-08-15T06:49:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"40d27f04f52fd2b0759438e69bd0a8e20f963d1f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/pulls/211/commits","review_comments_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/pulls/211/comments","review_comment_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/issues/211/comments","statuses_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/statuses/f00c2116e272891a815f2c77382235e1dac589b4","head":{"label":"Akhilesh05:added-jid-history","ref":"added-jid-history","sha":"f00c2116e272891a815f2c77382235e1dac589b4","user":{"login":"Akhilesh05","id":2811408,"node_id":"MDQ6VXNlcjI4MTE0MDg=","avatar_url":"https://avatars1.githubusercontent.com/u/2811408?v=4","gravatar_id":"","url":"https://api.github.com/users/Akhilesh05","html_url":"https://github.com/Akhilesh05","followers_url":"https://api.github.com/users/Akhilesh05/followers","following_url":"https://api.github.com/users/Akhilesh05/following{/other_user}","gists_url":"https://api.github.com/users/Akhilesh05/gists{/gist_id}","starred_url":"https://api.github.com/users/Akhilesh05/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Akhilesh05/subscriptions","organizations_url":"https://api.github.com/users/Akhilesh05/orgs","repos_url":"https://api.github.com/users/Akhilesh05/repos","events_url":"https://api.github.com/users/Akhilesh05/events{/privacy}","received_events_url":"https://api.github.com/users/Akhilesh05/received_events","type":"User","site_admin":false},"repo":{"id":140818380,"node_id":"MDEwOlJlcG9zaXRvcnkxNDA4MTgzODA=","name":"sidekiq-cron","full_name":"Akhilesh05/sidekiq-cron","owner":{"login":"Akhilesh05","id":2811408,"node_id":"MDQ6VXNlcjI4MTE0MDg=","avatar_url":"https://avatars1.githubusercontent.com/u/2811408?v=4","gravatar_id":"","url":"https://api.github.com/users/Akhilesh05","html_url":"https://github.com/Akhilesh05","followers_url":"https://api.github.com/users/Akhilesh05/followers","following_url":"https://api.github.com/users/Akhilesh05/following{/other_user}","gists_url":"https://api.github.com/users/Akhilesh05/gists{/gist_id}","starred_url":"https://api.github.com/users/Akhilesh05/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Akhilesh05/subscriptions","organizations_url":"https://api.github.com/users/Akhilesh05/orgs","repos_url":"https://api.github.com/users/Akhilesh05/repos","events_url":"https://api.github.com/users/Akhilesh05/events{/privacy}","received_events_url":"https://api.github.com/users/Akhilesh05/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Akhilesh05/sidekiq-cron","description":"Scheduler / Cron for Sidekiq jobs","fork":true,"url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron","forks_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/forks","keys_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/teams","hooks_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/hooks","issue_events_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/issues/events{/number}","events_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/events","assignees_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/assignees{/user}","branches_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/branches{/branch}","tags_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/tags","blobs_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/git/refs{/sha}","trees_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/statuses/{sha}","languages_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/languages","stargazers_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/stargazers","contributors_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/contributors","subscribers_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/subscribers","subscription_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/subscription","commits_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/commits{/sha}","git_commits_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/git/commits{/sha}","comments_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/comments{/number}","issue_comment_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/issues/comments{/number}","contents_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/contents/{+path}","compare_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/merges","archive_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/downloads","issues_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/issues{/number}","pulls_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/pulls{/number}","milestones_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/milestones{/number}","notifications_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/labels{/name}","releases_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/releases{/id}","deployments_url":"https://api.github.com/repos/Akhilesh05/sidekiq-cron/deployments","created_at":"2018-07-13T08:16:50Z","updated_at":"2018-07-17T10:57:05Z","pushed_at":"2018-07-17T17:08:12Z","git_url":"git://github.com/Akhilesh05/sidekiq-cron.git","ssh_url":"git@github.com:Akhilesh05/sidekiq-cron.git","clone_url":"https://github.com/Akhilesh05/sidekiq-cron.git","svn_url":"https://github.com/Akhilesh05/sidekiq-cron","homepage":"","size":528,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ondrejbartas:master","ref":"master","sha":"b215aa2abfabc1ca31372770c72738667f1703cf","user":{"login":"ondrejbartas","id":45809,"node_id":"MDQ6VXNlcjQ1ODA5","avatar_url":"https://avatars0.githubusercontent.com/u/45809?v=4","gravatar_id":"","url":"https://api.github.com/users/ondrejbartas","html_url":"https://github.com/ondrejbartas","followers_url":"https://api.github.com/users/ondrejbartas/followers","following_url":"https://api.github.com/users/ondrejbartas/following{/other_user}","gists_url":"https://api.github.com/users/ondrejbartas/gists{/gist_id}","starred_url":"https://api.github.com/users/ondrejbartas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ondrejbartas/subscriptions","organizations_url":"https://api.github.com/users/ondrejbartas/orgs","repos_url":"https://api.github.com/users/ondrejbartas/repos","events_url":"https://api.github.com/users/ondrejbartas/events{/privacy}","received_events_url":"https://api.github.com/users/ondrejbartas/received_events","type":"User","site_admin":false},"repo":{"id":12357002,"node_id":"MDEwOlJlcG9zaXRvcnkxMjM1NzAwMg==","name":"sidekiq-cron","full_name":"ondrejbartas/sidekiq-cron","owner":{"login":"ondrejbartas","id":45809,"node_id":"MDQ6VXNlcjQ1ODA5","avatar_url":"https://avatars0.githubusercontent.com/u/45809?v=4","gravatar_id":"","url":"https://api.github.com/users/ondrejbartas","html_url":"https://github.com/ondrejbartas","followers_url":"https://api.github.com/users/ondrejbartas/followers","following_url":"https://api.github.com/users/ondrejbartas/following{/other_user}","gists_url":"https://api.github.com/users/ondrejbartas/gists{/gist_id}","starred_url":"https://api.github.com/users/ondrejbartas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ondrejbartas/subscriptions","organizations_url":"https://api.github.com/users/ondrejbartas/orgs","repos_url":"https://api.github.com/users/ondrejbartas/repos","events_url":"https://api.github.com/users/ondrejbartas/events{/privacy}","received_events_url":"https://api.github.com/users/ondrejbartas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ondrejbartas/sidekiq-cron","description":"Scheduler / Cron for Sidekiq jobs","fork":false,"url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron","forks_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/forks","keys_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/teams","hooks_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/hooks","issue_events_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/issues/events{/number}","events_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/events","assignees_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/assignees{/user}","branches_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/branches{/branch}","tags_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/tags","blobs_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/git/refs{/sha}","trees_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/statuses/{sha}","languages_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/languages","stargazers_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/stargazers","contributors_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/contributors","subscribers_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/subscribers","subscription_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/subscription","commits_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/commits{/sha}","git_commits_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/git/commits{/sha}","comments_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/comments{/number}","issue_comment_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/issues/comments{/number}","contents_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/contents/{+path}","compare_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/merges","archive_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/downloads","issues_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/issues{/number}","pulls_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/pulls{/number}","milestones_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/milestones{/number}","notifications_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/labels{/name}","releases_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/releases{/id}","deployments_url":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/deployments","created_at":"2013-08-25T09:43:05Z","updated_at":"2018-08-15T06:45:42Z","pushed_at":"2018-08-15T06:45:46Z","git_url":"git://github.com/ondrejbartas/sidekiq-cron.git","ssh_url":"git@github.com:ondrejbartas/sidekiq-cron.git","clone_url":"https://github.com/ondrejbartas/sidekiq-cron.git","svn_url":"https://github.com/ondrejbartas/sidekiq-cron","homepage":"","size":489,"stargazers_count":857,"watchers_count":857,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":124,"mirror_url":null,"archived":false,"open_issues_count":32,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":124,"open_issues":32,"watchers":857,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/pulls/211"},"html":{"href":"https://github.com/ondrejbartas/sidekiq-cron/pull/211"},"issue":{"href":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/issues/211"},"comments":{"href":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/issues/211/comments"},"review_comments":{"href":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/pulls/211/comments"},"review_comment":{"href":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/pulls/211/commits"},"statuses":{"href":"https://api.github.com/repos/ondrejbartas/sidekiq-cron/statuses/f00c2116e272891a815f2c77382235e1dac589b4"}},"author_association":"NONE"}}
{"actor":{"display_login":"ondrejbartas"}}