resqued 0.7.8 → 0.7.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5caac7ba20bcafd74ebd32d58aa0b88d9ca8c0a
4
- data.tar.gz: 0b0ee3b38fd6fe32ee2e5b73453e75a8479cf953
3
+ metadata.gz: c8e7be4711322272287bceeae0c9192c20231b21
4
+ data.tar.gz: 259b3e8da585db42bc351d81ace7eaab284f8df0
5
5
  SHA512:
6
- metadata.gz: 8cad488ec507dc2f56fe099baa6dbe274c26dc27a546d05327f5b6e8414490b2d5edcb0280be86e3f61372dc05fd33fb38a0d92315c9ff7228c9bfd1b8993369
7
- data.tar.gz: b47aecd6cbb52c6894becdc33a818389d483c0862f54a361d22c39f95d1574031fbbbce7ee7255a6ac6973d116bf900697c6ceba8e0cccc70964e1a6910f12d1
6
+ metadata.gz: ab5c1d07edf8e9e1f500236de138da349d8f25b7608d03476208d307c282bce47540c2c354487229991f17ca1348b1911d0a7e82856b9dbf85a7cdb02e8c9dc5
7
+ data.tar.gz: 99ceb6e83b86c23f0f605ebf41e30bc096b720c51647a5d8f8e23b00373b2b757cfae08303a4249f9c550611ff9b9be588ae42cf330d7ecee9c6b60377f1737b
data/CHANGES.md ADDED
@@ -0,0 +1,53 @@
1
+ Starting with version 0.6.1, resqued uses semantic versioning to indicate incompatibilities between the master process, listener process, and configuration.
2
+
3
+ 0.7.9
4
+ -----
5
+
6
+ * Add the app's current version to the procline. (#30)
7
+
8
+ 0.7.8
9
+ -----
10
+
11
+ * Avoid losing track of workers (#21, #29)
12
+
13
+ 0.7.7
14
+ -----
15
+
16
+ * Open source: set new gem home page, run CI on travis, etc.
17
+ * Rewrite Resqued::TestCase.
18
+
19
+ 0.7.6
20
+ -----
21
+
22
+ * Adds more logging.
23
+
24
+ 0.7.4
25
+ -----
26
+
27
+ * Better logging with (Mono)Logger!
28
+ * Unregister resqued's signal handlers before running a resque worker.
29
+ * Report the number of workers spinning down.
30
+
31
+ 0.7.3
32
+ -----
33
+
34
+ broken
35
+
36
+ 0.7.2
37
+ -----
38
+
39
+ * Ensure that no stale log file handles exists after a SIGHUP.
40
+
41
+ 0.7.1
42
+ -----
43
+
44
+ * Adds some `assert_resqued` test helpers.
45
+
46
+ 0.7.0
47
+ -----
48
+
49
+ * Configuration was changed. In a worker pool, you can no longer specify the number of workers in a bare argument, e.g. `queue "queue_name", "50%"`. Now, you must use a hash to define how many workers work on a given queue, e.g. `queue "queue_name", :percent => 50`. Additionally, you can provide several queues in one call to queue, e.g. `queue "a", "b", "c"`.
50
+
51
+ * A message was added to indicate that a listener has started. This lets the master wait until the new listener is fully booted before it kills the old listener.
52
+
53
+ * The master advertises its version to the listener. This will make it easier to update the protocol between the master and listener in a backward-compatible way.
@@ -18,8 +18,8 @@ module Resqued
18
18
  end
19
19
 
20
20
  # Public: Performs the `before_fork` action from the config.
21
- def before_fork
22
- Resqued::Config::BeforeFork.new.apply_all(@config_data)
21
+ def before_fork(resqued)
22
+ Resqued::Config::BeforeFork.new(:resqued => resqued).apply_all(@config_data)
23
23
  end
24
24
 
25
25
  # Public: Performs the `after_fork` action from the config.
@@ -8,9 +8,13 @@ module Resqued
8
8
  # # Runs once, before forking all the workers.
9
9
  # end
10
10
  class BeforeFork < Base
11
+ def initialize(options = {})
12
+ @resqued = options.fetch(:resqued)
13
+ end
14
+
11
15
  # DSL: Execute the `before_fork` block.
12
16
  def before_fork
13
- yield
17
+ yield @resqued
14
18
  end
15
19
  end
16
20
  end
@@ -3,6 +3,7 @@ require 'socket'
3
3
  require 'resqued/config'
4
4
  require 'resqued/logging'
5
5
  require 'resqued/procline_version'
6
+ require 'resqued/runtime_info'
6
7
  require 'resqued/sleepy'
7
8
  require 'resqued/version'
8
9
  require 'resqued/worker'
@@ -70,7 +71,7 @@ module Resqued
70
71
 
71
72
  config = Resqued::Config.new(@config_paths)
72
73
  set_default_resque_logger
73
- config.before_fork
74
+ config.before_fork(info)
74
75
  report_to_master("RUNNING")
75
76
 
76
77
  write_procline('running')
@@ -233,10 +234,16 @@ module Resqued
233
234
  def write_procline(status)
234
235
  procline = "#{procline_version} listener"
235
236
  procline << " #{@listener_id}" if @listener_id
237
+ procline << " [#{info.app_version}]" if info.app_version
236
238
  procline << " [#{status}]"
237
239
  procline << " [#{running_workers.size} workers]" if status == 'shutdown'
238
240
  procline << " #{@config_paths.join(' ')}"
239
241
  $0 = procline
240
242
  end
243
+
244
+ # Private.
245
+ def info
246
+ @info ||= RuntimeInfo.new
247
+ end
241
248
  end
242
249
  end
@@ -0,0 +1,5 @@
1
+ module Resqued
2
+ class RuntimeInfo
3
+ attr_accessor :app_version
4
+ end
5
+ end
@@ -1,4 +1,5 @@
1
1
  require 'resqued/config'
2
+ require 'resqued/runtime_info'
2
3
 
3
4
  module Resqued
4
5
  module TestCase
@@ -14,7 +15,7 @@ module Resqued
14
15
  # assert_resqued 'config/resqued-environment.rb', 'config/resqued-workers.rb'
15
16
  def assert_resqued(*paths)
16
17
  config = Resqued::Config.new(paths)
17
- config.before_fork
18
+ config.before_fork(RuntimeInfo.new)
18
19
  config.build_workers
19
20
  config.after_fork(Resque::Worker.new('*'))
20
21
  end
@@ -1,3 +1,3 @@
1
1
  module Resqued
2
- VERSION = '0.7.8'
2
+ VERSION = '0.7.9'
3
3
  end
@@ -1,6 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'resqued/config/after_fork'
3
3
  require 'resqued/config/before_fork'
4
+ require 'resqued/runtime_info'
4
5
 
5
6
  describe do
6
7
  before { evaluator.apply(config) }
@@ -50,11 +51,16 @@ describe do
50
51
  before_fork do
51
52
  $before_fork_called = true
52
53
  end
54
+ before_fork do |resqued|
55
+ resqued.app_version = "example"
56
+ end
53
57
  END_CONFIG
54
58
 
55
- let(:evaluator) { $before_fork_called = false ; Resqued::Config::BeforeFork.new }
59
+ let(:evaluator) { $before_fork_called = false ; Resqued::Config::BeforeFork.new(:resqued => resqued) }
60
+ let(:resqued) { Resqued::RuntimeInfo.new }
56
61
 
57
62
  it { expect($before_fork_called).to eq(true) }
63
+ it { expect(resqued.app_version).to eq("example") }
58
64
  end
59
65
  end
60
66
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resqued
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.8
4
+ version: 0.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Burke
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2013-12-02 00:00:00.000000000 Z
11
+ date: 2013-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kgio
@@ -102,12 +102,14 @@ files:
102
102
  - lib/resqued/master.rb
103
103
  - lib/resqued/pidfile.rb
104
104
  - lib/resqued/procline_version.rb
105
+ - lib/resqued/runtime_info.rb
105
106
  - lib/resqued/sleepy.rb
106
107
  - lib/resqued/test_case.rb
107
108
  - lib/resqued/version.rb
108
109
  - lib/resqued/worker.rb
109
110
  - lib/resqued.rb
110
111
  - README.md
112
+ - CHANGES.md
111
113
  - docs/ipc.md
112
114
  - docs/processes.md
113
115
  - docs/signals.md