creeper 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -27,7 +27,8 @@ module Creeper
27
27
  ## default configuration ##
28
28
 
29
29
  @beanstalk_url = ENV['BEANSTALK_URL'] || 'beanstalk://127.0.0.1/'
30
- @logger = ::Logger.new($stderr)
30
+ @error_logger = ::Logger.new($stderr)
31
+ @logger = ::Logger.new($stdout)
31
32
  @patience_soft = 60
32
33
  @patience_hard = 30
33
34
  @pool_size = 2
@@ -100,7 +101,9 @@ module Creeper
100
101
  def work(jobs = nil, size = 2)
101
102
  require 'creeper/worker'
102
103
 
103
- Creeper::Worker.work(jobs, size)
104
+ Creeper.pool_size = size
105
+
106
+ Creeper::Worker.work(jobs, Creeper.pool_size)
104
107
  end
105
108
 
106
109
  ##
@@ -19,7 +19,7 @@ module Creeper
19
19
 
20
20
  # Send an error message
21
21
  def error(string)
22
- Creeper.logger.error(string) if Creeper.logger
22
+ Creeper.error_logger.error(string) if Creeper.error_logger
23
23
  end
24
24
 
25
25
  # Handle a crash
@@ -1,3 +1,3 @@
1
1
  module Creeper
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -4,7 +4,7 @@ require 'celluloid'
4
4
  require 'creeper/celluloid_ext'
5
5
  # require 'em-jack'
6
6
 
7
- Creeper.logger = Celluloid.logger
7
+ Creeper.error_logger = Celluloid.logger
8
8
 
9
9
  module Creeper
10
10
 
@@ -16,7 +16,7 @@ module Creeper
16
16
 
17
17
  options = {
18
18
  size: size,
19
- args: [jobs, size]
19
+ args: [jobs]
20
20
  }
21
21
 
22
22
  Creeper.worker_pool = Creeper::Worker.pool(options)
@@ -91,11 +91,10 @@ module Creeper
91
91
  include Celluloid
92
92
 
93
93
  attr_accessor :number
94
- attr_reader :jobs, :pool_size
94
+ attr_reader :jobs
95
95
 
96
- def initialize(jobs = nil, pool_size = 2)
97
- @jobs = self.class.jobs_for(jobs)
98
- @pool_size = pool_size
96
+ def initialize(jobs = nil)
97
+ @jobs = self.class.jobs_for(jobs)
99
98
 
100
99
  Creeper.register_worker(self)
101
100
  Logger.info "#{prefix} Working #{self.jobs.size} jobs: [ #{self.jobs.join(' ')} ]"
@@ -110,7 +109,7 @@ module Creeper
110
109
  end
111
110
 
112
111
  def number_format
113
- "%#{pool_size.to_s.length}d"
112
+ "%#{Creeper.pool_size.to_s.length}d"
114
113
  end
115
114
 
116
115
  def time_in_milliseconds
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: creeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: