From e8eaffbd724e8618bfb58b6f0fba88bae4c8ee1b Mon Sep 17 00:00:00 2001
From: Guo Xiang Tan <tgx_world@hotmail.com>
Date: Thu, 6 Apr 2017 10:52:13 +0800
Subject: [PATCH] FIX: Add onceoff job to remove old auto close topic sidekiq
 jobs.

---
 app/jobs/onceoff/remove_old_auto_close_jobs.rb | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 app/jobs/onceoff/remove_old_auto_close_jobs.rb

diff --git a/app/jobs/onceoff/remove_old_auto_close_jobs.rb b/app/jobs/onceoff/remove_old_auto_close_jobs.rb
new file mode 100644
index 00000000000..17dbfc9284f
--- /dev/null
+++ b/app/jobs/onceoff/remove_old_auto_close_jobs.rb
@@ -0,0 +1,10 @@
+module Jobs
+  class RemoveOldAutoCloseJobs < Jobs::Onceoff
+    def execute_onceoff(args)
+      Jobs.cancel_scheduled_for(:close_topic)
+
+      # No need to enqueue new jobs since we have a scheduled job that will
+      # automatically enqueue the new jobs.
+    end
+  end
+end