Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix delayed_job functionality

  • Loading branch information...
commit 4daf742a7f84c53ae683358b4c1d27b6e0b131e4 1 parent 12c5213
@edtsech authored
View
9 db/migrate/002_add_delayed_job_id_to_issue.rb
@@ -0,0 +1,9 @@
+class AddDelayedJobIdToIssue < ActiveRecord::Migration
+ def self.up
+ add_column :issues, :delayed_job_id, :integer
+ end
+
+ def self.down
+ remove_column :issues, :delayed_job_id
+ end
+end
View
6 lib/issue_closed.rb
@@ -60,7 +60,11 @@ def edit
status_before_update != @issue.status and \
@issue.status.state == false
- Delayed::Job.enqueue DelayedClose.new(@issue.id), 0, 7.days.from_now
+ Delayed::Job.destroy(@issue.delayed_job_id) unless @issue.delayed_job_id == nil
+ job = Delayed::Job.enqueue DelayedClose.new(@issue.id), 0, 7.days.from_now
+
+ @issue.delayed_job_id = job.id
+ @issue.save
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.