Skip to content

Commit

Permalink
Merge branch 'switch_to_after_commit'
Browse files Browse the repository at this point in the history
* switch_to_after_commit:
  Scale the workers after_commit
  • Loading branch information
davidakachaos committed Dec 7, 2012
2 parents 0305b2c + 87d0354 commit 2c7b1b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/workless/scaler.rb
Expand Up @@ -10,9 +10,9 @@ module Scaler
def self.included(base)
base.send :extend, ClassMethods
base.class_eval do
after_destroy "self.class.scaler.down"
after_create "self.class.scaler.up"
after_update "self.class.scaler.down", :unless => Proc.new {|r| r.failed_at.nil? }
after_commit "self.class.scaler.down", :on => :destroy
after_commit "self.class.scaler.up", :on => :create
after_commit "self.class.scaler.down", :on => :update, :unless => Proc.new {|r| r.failed_at.nil? }
end

end
Expand Down
8 changes: 1 addition & 7 deletions spec/spec_helper.rb
Expand Up @@ -8,13 +8,7 @@
module Delayed
module Job
class Delayed::Job::Mock
def self.after_destroy(method, *args)
end

def self.after_create(method, *args)
end

def self.after_update(method, *args)
def self.after_commit(method, *args, &block)
end
end
end
Expand Down

0 comments on commit 2c7b1b6

Please sign in to comment.