Permalink
Browse files

Merge branch 'switch_to_after_commit'

* switch_to_after_commit:
  Scale the workers after_commit
  • Loading branch information...
2 parents 0305b2c + 87d0354 commit 2c7b1b65771dc4519543131ae483d8af489e7c65 @davidakachaos committed Dec 7, 2012
Showing with 4 additions and 10 deletions.
  1. +3 −3 lib/workless/scaler.rb
  2. +1 −7 spec/spec_helper.rb
View
@@ -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
View
@@ -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

0 comments on commit 2c7b1b6

Please sign in to comment.