workless 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -11,21 +11,46 @@ This one takes bits from both and is helping me understand gem and plugin develo
11
11
 
12
12
  h2. Installation
13
13
 
14
- Add the gem to your Gemfile
14
+ Add the gem to your project Gemfile and update your bundle
15
15
 
16
16
  <pre>
17
17
  gem "workless"
18
18
  </pre>
19
19
 
20
+ Add your Heroku username / password as config vars to your Heroku instance, the same one you log in to Heroku with
21
+
22
+ <pre>
23
+ heroku config:add HEROKU_USER=<your username> HEROKU_PASSWORD=<your password>
24
+ </pre>
25
+
26
+ h2. Failing Jobs
27
+
28
+ In the case of failed jobs Workless will only shut down the dj worker if all attempts have been tried. By default Delayed Job will try 25 times to process a job with ever increasing time delays between each unsucessful attempt. Because of this Workless configures Delayed Job to try failed jobs only 3 times to reduce the amount of time a worker can be running while trying to process them.
29
+
30
+ h2. Configuration
31
+
32
+ Workless can be disabled by using the null scaler that will ignore the workers requests to scale up and down. In an environment file add this:
33
+
34
+ <pre>
35
+ Delayed::Job.scaler = :null
36
+ </pre>
37
+
38
+ There are two other scalers included but generally these will be chosen for you based on if its running on Heroku
39
+
40
+ <pre>
41
+ Delayed::Job.scaler = :heroku
42
+ Delayed::Job.scaler = :local
43
+ </pre>
44
+
45
+ The local scaler uses @adamwiggins rush library http://github.com/adamwiggins/rush to start and stop workers on a local machine
46
+
20
47
  h2. Note on Patches/Pull Requests
21
48
 
22
- * Fork the project.
49
+ * Please fork the project, as you can see there are no tests and at present I don't know how to go about adding them so any advice would be welcome.
23
50
  * Make your feature addition or bug fix.
24
- * Add tests for it. This is important so I don't break it in a
25
- future version unintentionally.
26
51
  * Commit, do not mess with rakefile, version, or history.
27
52
  (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
28
- * Send me a pull request. Bonus points for topic branches.
53
+ * Send me a pull request.
29
54
 
30
55
  h2. Copyright
31
56
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -3,6 +3,7 @@ require 'rails'
3
3
  module Delayed
4
4
  class Railtie < Rails::Railtie
5
5
  initializer :after_initialize do
6
+ puts "attempts #{Delayed::Worker.max_attempts}"
6
7
  Delayed::Backend::ActiveRecord::Job.send(:include, Delayed::Workless::Scaler) if defined?(Delayed::Backend::ActiveRecord::Job)
7
8
  end
8
9
  end
@@ -25,7 +25,8 @@ module Delayed
25
25
  end
26
26
 
27
27
  def scaler=(scaler)
28
- @scaler = scaler
28
+ require File.dirname(__FILE__) + "/scalers/#{scaler.to_s}"
29
+ @scaler = "Delayed::Workless::Scaler::#{scaler.to_s.camelize}".constantize.new
29
30
  end
30
31
  end
31
32
 
@@ -0,0 +1,17 @@
1
+ module Delayed
2
+ module Workless
3
+ module Scaler
4
+
5
+ class Null < Base
6
+
7
+ def up
8
+ end
9
+
10
+ def down
11
+ end
12
+
13
+ end
14
+
15
+ end
16
+ end
17
+ end
data/workless.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{workless}
8
- s.version = "0.0.3"
8
+ s.version = "0.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["lostboy"]
12
- s.date = %q{2010-09-30}
12
+ s.date = %q{2010-10-01}
13
13
  s.description = %q{Extension to Delayed Job to enable workers to scale up when needed}
14
14
  s.email = %q{paul.crabtree@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "lib/workless/scalers/base.rb",
34
34
  "lib/workless/scalers/heroku.rb",
35
35
  "lib/workless/scalers/local.rb",
36
+ "lib/workless/scalers/null.rb",
36
37
  "test/helper.rb",
37
38
  "test/test_workless.rb",
38
39
  "workless.gemspec"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - lostboy
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-30 00:00:00 +01:00
17
+ date: 2010-10-01 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -117,6 +117,7 @@ files:
117
117
  - lib/workless/scalers/base.rb
118
118
  - lib/workless/scalers/heroku.rb
119
119
  - lib/workless/scalers/local.rb
120
+ - lib/workless/scalers/null.rb
120
121
  - test/helper.rb
121
122
  - test/test_workless.rb
122
123
  - workless.gemspec