diff --git a/app/services/issues/base_service.rb b/app/services/issues/base_service.rb index af25cf2c819..9f6cfc0f6d3 100644 --- a/app/services/issues/base_service.rb +++ b/app/services/issues/base_service.rb @@ -7,12 +7,6 @@ module Issues hook_data end - def schedule_due_date_email(issuable) - return if issuable.due_date.nil? - - IssueDueWorker.perform_at(issuable.due_date.to_time, issuable.id) - end - def reopen_service Issues::ReopenService end diff --git a/app/services/issues/create_service.rb b/app/services/issues/create_service.rb index a253020b9c3..0307634c0b6 100644 --- a/app/services/issues/create_service.rb +++ b/app/services/issues/create_service.rb @@ -27,7 +27,6 @@ module Issues todo_service.new_issue(issuable, current_user) user_agent_detail_service.create resolve_discussions_with_issue(issuable) - schedule_due_date_email(issuable) super end diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index e8fdf9901c1..d7aa7e2347e 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -13,10 +13,6 @@ module Issues spam_check(issue, current_user) end - def after_update(issue) - schedule_due_date_email(issue) - end - def handle_changes(issue, options) old_associations = options.fetch(:old_associations, {}) old_labels = old_associations.fetch(:labels, []) @@ -27,9 +23,6 @@ module Issues todo_service.mark_pending_todos_as_done(issue, current_user) end - # TODO: If due date doesn't change, don't bother updating the due date - # email worker - if issue.previous_changes.include?('title') || issue.previous_changes.include?('description') todo_service.update_issue(issue, current_user, old_mentioned_users) diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 93ad55fdd70..7598e579c26 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -18,6 +18,7 @@ - cronjob:stuck_import_jobs - cronjob:stuck_merge_jobs - cronjob:trending_projects +- cronjob:issue_due - gcp_cluster:cluster_install_app - gcp_cluster:cluster_provision @@ -78,7 +79,6 @@ - group_destroy - invalid_gpg_signature_update - irker -- issue_due - merge - namespaceless_project_destroy - new_issue diff --git a/app/workers/issue_due_worker.rb b/app/workers/issue_due_worker.rb index ddd61d7b912..90d2cc09f1b 100644 --- a/app/workers/issue_due_worker.rb +++ b/app/workers/issue_due_worker.rb @@ -1,9 +1,9 @@ class IssueDueWorker include ApplicationWorker + include CronjobQueue - def perform(issue_id) - issue = Issue.find_by_id(issue_id) - if issue.due_date == Date.today + def perform + Issue.where(due_date: Date.today).find_each do |issue| NotificationService.new.issue_due_email(issue) end end diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 53cf0010d8e..023dc8a273d 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -431,6 +431,10 @@ Settings.cron_jobs['pages_domain_verification_cron_worker'] ||= Settingslogic.ne Settings.cron_jobs['pages_domain_verification_cron_worker']['cron'] ||= '*/15 * * * *' Settings.cron_jobs['pages_domain_verification_cron_worker']['job_class'] = 'PagesDomainVerificationCronWorker' +Settings.cron_jobs['issue_due_worker'] ||= Settingslogic.new({}) +Settings.cron_jobs['issue_due_worker']['cron'] ||= '50 00 * * *' +Settings.cron_jobs['issue_due_worker']['job_class'] = 'IssueDueWorker' + # # GitLab Shell # diff --git a/config/sidekiq_queues.yml b/config/sidekiq_queues.yml index 5c0bf091b18..554502c5d83 100644 --- a/config/sidekiq_queues.yml +++ b/config/sidekiq_queues.yml @@ -48,7 +48,6 @@ - [authorized_projects, 1] - [expire_build_instance_artifacts, 1] - [group_destroy, 1] - - [issue_due, 1] - [irker, 1] - [namespaceless_project_destroy, 1] - [project_cache, 1]