Commit 9d81d5aa authored by Stuart Nelson's avatar Stuart Nelson Committed by Sean McGivern

Use cron for sending emails

parent ff830bc1
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
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
......
......@@ -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
#
......
......@@ -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]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment