Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

spawn workers after_create

fixes #29
  • Loading branch information...
commit 4343492d3e18e071d05c57c429806ad7a478541d 1 parent 65fa105
@filiptepper authored
Showing with 8 additions and 8 deletions.
  1. +7 −7 lib/workless/scaler.rb
  2. +1 −1  spec/spec_helper.rb
View
14 lib/workless/scaler.rb
@@ -4,19 +4,19 @@
require 'workless/scalers/null'
module Delayed
- module Workless
+ module Workless
module Scaler
-
+
def self.included(base)
base.send :extend, ClassMethods
base.class_eval do
after_destroy "self.class.scaler.down"
- before_create "self.class.scaler.up"
+ after_create "self.class.scaler.up"
after_update "self.class.scaler.down", :unless => Proc.new {|r| r.failed_at.nil? }
end
-
+
end
-
+
module ClassMethods
def scaler
@scaler ||= if ENV.include?("HEROKU_API_KEY")
@@ -30,8 +30,8 @@ def scaler=(scaler)
@scaler = "Delayed::Workless::Scaler::#{scaler.to_s.camelize}".constantize
end
end
-
+
end
-
+
end
end
View
2  spec/spec_helper.rb
@@ -11,7 +11,7 @@ class Delayed::Job::Mock
def self.after_destroy(method, *args)
end
- def self.before_create(method, *args)
+ def self.after_create(method, *args)
end
def self.after_update(method, *args)
Please sign in to comment.
Something went wrong with that request. Please try again.