Skip to content

Commit

Permalink
fix delayed_job functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
edtsech committed Nov 4, 2009
1 parent 12c5213 commit 4daf742
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions 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
6 changes: 5 additions & 1 deletion lib/issue_closed.rb
Expand Up @@ -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
Expand Down

0 comments on commit 4daf742

Please sign in to comment.