sidekiq 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sidekiq might be problematic. Click here for more details.

data/Changes.md CHANGED
@@ -1,6 +1,16 @@
1
+ 2.2.1
2
+ -----------
3
+
4
+ - Add support for custom tabs to Sidekiq::Web [#346]
5
+ - Change capistrano recipe to run 'quiet' before deploy:update\_code so
6
+ it is run upon both 'deploy' and 'deploy:migrations'. [#352]
7
+ - Rescue Exception rather than StandardError to catch and log any sort
8
+ of Processor death.
9
+
1
10
  2.2.0
2
11
  -----------
3
12
 
13
+ - Roll back Celluloid optimizations in 2.1.0 which caused instability.
4
14
  - Add extension to delay any arbitrary class method to Sidekiq.
5
15
  Previously this was limited to ActiveRecord classes.
6
16
 
@@ -1,28 +1,29 @@
1
1
  Capistrano::Configuration.instance.load do
2
- before "deploy", "sidekiq:quiet"
2
+ before "deploy:update_code", "sidekiq:quiet"
3
3
  after "deploy:stop", "sidekiq:stop"
4
4
  after "deploy:start", "sidekiq:start"
5
5
  after "deploy:restart", "sidekiq:restart"
6
6
 
7
7
  _cset(:sidekiq_timeout) { 10 }
8
- _cset(:sidekiq_role) { :app }
8
+ _cset(:sidekiq_role) { :app }
9
+ _cset(:sidekiq_pid) { "#{current_path}/tmp/pids/sidekiq.pid" }
9
10
 
10
11
  namespace :sidekiq do
11
12
 
12
13
  desc "Quiet sidekiq (stop accepting new work)"
13
14
  task :quiet, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
14
- run "if [ -d #{current_path} ] && [ -f #{current_path}/tmp/pids/sidekiq.pid ]; then cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl quiet #{current_path}/tmp/pids/sidekiq.pid ; fi"
15
+ run "if [ -d #{current_path} ] && [ -f #{fetch :sidekiq_pid} ]; then cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl quiet #{fetch :sidekiq_pid} ; fi"
15
16
  end
16
17
 
17
18
  desc "Stop sidekiq"
18
19
  task :stop, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
19
- run "if [ -d #{current_path} ] && [ -f #{current_path}/tmp/pids/sidekiq.pid ]; then cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl stop #{current_path}/tmp/pids/sidekiq.pid #{fetch :sidekiq_timeout} ; fi"
20
+ run "if [ -d #{current_path} ] && [ -f #{fetch :sidekiq_pid} ]; then cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl stop #{fetch :sidekiq_pid} #{fetch :sidekiq_timeout} ; fi"
20
21
  end
21
22
 
22
23
  desc "Start sidekiq"
23
24
  task :start, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
24
25
  rails_env = fetch(:rails_env, "production")
25
- run "cd #{current_path} ; nohup #{fetch(:bundle_cmd, "bundle")} exec sidekiq -e #{rails_env} -C #{current_path}/config/sidekiq.yml -P #{current_path}/tmp/pids/sidekiq.pid >> #{current_path}/log/sidekiq.log 2>&1 &", :pty => false
26
+ run "cd #{current_path} ; nohup #{fetch(:bundle_cmd, "bundle")} exec sidekiq -e #{rails_env} -C #{current_path}/config/sidekiq.yml -P #{fetch :sidekiq_pid} >> #{current_path}/log/sidekiq.log 2>&1 &", :pty => false
26
27
  end
27
28
 
28
29
  desc "Restart sidekiq"
@@ -43,7 +43,7 @@ module Sidekiq
43
43
  worker.perform(*cloned(msg['args']))
44
44
  end
45
45
  end
46
- rescue => ex
46
+ rescue Exception => ex
47
47
  handle_exception(ex, msg || { :message => msgstr })
48
48
  raise
49
49
  end
@@ -1,3 +1,3 @@
1
1
  module Sidekiq
2
- VERSION = "2.2.0"
2
+ VERSION = "2.2.1"
3
3
  end
@@ -111,6 +111,10 @@ module Sidekiq
111
111
  def display_args(args, count=100)
112
112
  args.map { |arg| a = arg.inspect; a.size > count ? "#{a[0..count]}..." : a }.join(", ")
113
113
  end
114
+
115
+ def tabs
116
+ self.class.tabs
117
+ end
114
118
  end
115
119
 
116
120
  get "/" do
@@ -223,6 +227,10 @@ module Sidekiq
223
227
  end
224
228
  end
225
229
 
230
+ def self.tabs
231
+ @tabs ||= ["Queues", "Retries", "Scheduled"]
232
+ end
233
+
226
234
  end
227
235
 
228
236
  end
@@ -24,7 +24,7 @@ class TestInline < MiniTest::Unit::TestCase
24
24
  class InlineWorkerWithTimeParam
25
25
  include Sidekiq::Worker
26
26
  def perform(time)
27
- raise ParameterIsNotString unless time.is_a?(String)
27
+ raise ParameterIsNotString unless time.is_a?(String) || time.is_a?(Numeric)
28
28
  end
29
29
  end
30
30
 
@@ -148,6 +148,15 @@ class TestWeb < MiniTest::Unit::TestCase
148
148
  assert_match /#{msg['args'][2]}/, last_response.body
149
149
  end
150
150
 
151
+ it 'can show user defined tab' do
152
+ Sidekiq::Web.tabs << 'Custom Tab'
153
+
154
+ get '/'
155
+ assert_match 'Custom Tab', last_response.body
156
+
157
+ Sidekiq::Web.tabs.delete 'Custom Tab'
158
+ end
159
+
151
160
  def add_scheduled
152
161
  msg = { 'class' => 'HardWorker',
153
162
  'args' => ['bob', 1, Time.now.to_f],
@@ -20,6 +20,8 @@ $(function() {
20
20
  });
21
21
 
22
22
  $(function() {
23
+ function pad(n) { return ('0' + n).slice(-2); }
24
+
23
25
  $('a[name=poll]').data('polling', false);
24
26
 
25
27
  $('a[name=poll]').on('click', function(e) {
@@ -39,7 +41,7 @@ $(function() {
39
41
  $('.workers').replaceWith(responseHtml.find('.workers'));
40
42
  });
41
43
  var currentTime = new Date();
42
- $('.poll-status').text('Last polled at: ' + currentTime.getHours() + ':' + currentTime.getMinutes() + ':' + currentTime.getSeconds());
44
+ $('.poll-status').text('Last polled at: ' + currentTime.getHours() + ':' + pad(currentTime.getMinutes()) + ':' + pad(currentTime.getSeconds()));
43
45
  }, 2000));
44
46
  $('.poll-status').text('Starting to poll...');
45
47
  pollLink.text('Stop Polling');
@@ -11,4 +11,4 @@ table class="table table-striped table-bordered workers"
11
11
  td= msg['queue']
12
12
  td= msg['payload']['class']
13
13
  td= msg['payload']['args'].inspect[0..100]
14
- td== relative_time(Time.parse(msg['run_at']))
14
+ td== relative_time(msg['run_at'].is_a?(Numeric) ? Time.at(msg['run_at']) : Time.parse(msg['run_at']))
@@ -17,12 +17,10 @@ html
17
17
  ul.nav
18
18
  li
19
19
  a href='#{{root_path}}' Home
20
- li
21
- a href='#{{root_path}}queues' Queues
22
- li
23
- a href='#{{root_path}}retries' Retries
24
- li
25
- a href='#{{root_path}}scheduled' Scheduled
20
+ - tabs.each do |tab|
21
+ li
22
+ a href='#{{root_path}}#{{tab.downcase}}': #{tab}
23
+
26
24
  ul.nav.pull-right
27
25
  li
28
26
  a Redis: #{location}
@@ -22,11 +22,11 @@ header
22
22
  td= msg['retry_count']
23
23
  tr
24
24
  th Last Retry
25
- td== relative_time(Time.parse(msg['retried_at']))
25
+ td== relative_time(msg['retried_at'].is_a?(Numeric) ? Time.at(msg['retried_at']) : Time.parse(msg['retried_at']))
26
26
  - else
27
27
  tr
28
28
  th Originally Failed
29
- td== relative_time(Time.parse(msg['failed_at']))
29
+ td== relative_time(msg['failed_at'].is_a?(Numeric) ? Time.at(msg['failed_at']) : Time.parse(msg['failed_at']))
30
30
  tr
31
31
  th Next Retry
32
32
  td== relative_time(Time.at(@score))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-17 00:00:00.000000000 Z
12
+ date: 2012-08-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis