sidekiq 6.0.0 → 6.0.3

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.

Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +21 -0
  3. data/6.0-Upgrade.md +3 -1
  4. data/Changes.md +88 -1
  5. data/Ent-Changes.md +6 -0
  6. data/Gemfile.lock +3 -3
  7. data/Pro-Changes.md +9 -1
  8. data/README.md +3 -1
  9. data/bin/sidekiqload +8 -4
  10. data/bin/sidekiqmon +4 -5
  11. data/lib/generators/sidekiq/worker_generator.rb +10 -0
  12. data/lib/sidekiq/api.rb +117 -88
  13. data/lib/sidekiq/cli.rb +19 -17
  14. data/lib/sidekiq/client.rb +12 -2
  15. data/lib/sidekiq/fetch.rb +7 -7
  16. data/lib/sidekiq/job_logger.rb +11 -3
  17. data/lib/sidekiq/job_retry.rb +21 -8
  18. data/lib/sidekiq/launcher.rb +1 -3
  19. data/lib/sidekiq/logger.rb +107 -11
  20. data/lib/sidekiq/middleware/chain.rb +11 -2
  21. data/lib/sidekiq/monitor.rb +1 -16
  22. data/lib/sidekiq/paginator.rb +7 -2
  23. data/lib/sidekiq/processor.rb +17 -19
  24. data/lib/sidekiq/scheduled.rb +13 -12
  25. data/lib/sidekiq/testing.rb +12 -0
  26. data/lib/sidekiq/util.rb +0 -2
  27. data/lib/sidekiq/version.rb +1 -1
  28. data/lib/sidekiq/web/application.rb +8 -13
  29. data/lib/sidekiq/web/helpers.rb +22 -10
  30. data/lib/sidekiq/worker.rb +4 -4
  31. data/lib/sidekiq.rb +8 -0
  32. data/sidekiq.gemspec +1 -1
  33. data/web/assets/javascripts/dashboard.js +2 -2
  34. data/web/assets/stylesheets/application-dark.css +125 -0
  35. data/web/assets/stylesheets/application.css +9 -0
  36. data/web/locales/de.yml +14 -2
  37. data/web/views/_job_info.erb +2 -1
  38. data/web/views/busy.erb +4 -1
  39. data/web/views/dead.erb +2 -2
  40. data/web/views/layout.erb +1 -0
  41. data/web/views/morgue.erb +4 -1
  42. data/web/views/queue.erb +10 -1
  43. data/web/views/retries.erb +4 -1
  44. data/web/views/retry.erb +2 -2
  45. data/web/views/scheduled.erb +4 -1
  46. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fda3ed37e1d981e1b32eea70669c678d400c071a9146a919848bcc598612de25
4
- data.tar.gz: 6580ab6c188b2514efe807479ca25c06ea584d1def175d84d94639bc20f80b1e
3
+ metadata.gz: 289abeb95ea2defd87dce17b31747cc56193a3e606e7f1f87d9ab237706526cc
4
+ data.tar.gz: a9ee206b90eb90737d587da3033559f96150aaceda8b0d319fcca29a08507c56
5
5
  SHA512:
6
- metadata.gz: 25682d3dbf99d29fa3f56b7c74419863d3549b6e0c182e69c83fbc02a2955d053bca85eec53b474d4d22c7526e44e865f378aa4111152a91377b373be27c4d47
7
- data.tar.gz: e55d07434b1e2ab26df6748101bf10640fc08d4d93f00b75ed04d82ed309ee8529d652982430cd00671c98b5e53cc733bef4b686df58a6b0e116ba04c12139aa
6
+ metadata.gz: b9feed82f74bad9ae58674c373286522df5c2198ec4f685a777fc8ad2dd89f4f985dcfc81a1f915e77ae806e3fab060f5e662fd8378a4efc951da6b230ae3cd4
7
+ data.tar.gz: 1928083cc83adc9a248f6b9f9a5cd95c91b6a4a5c324cb38d4082309cf801031ac2f644a9f1aef3d7c49424dd4525da870af72e892f983c35cb07e4a214aa311
data/.circleci/config.yml CHANGED
@@ -32,6 +32,9 @@ jobs:
32
32
  - <<: *save
33
33
  - <<: *unit
34
34
  "ruby-2.6":
35
+ environment:
36
+ COVERAGE: true
37
+ CC_TEST_REPORTER_ID: 003c3033501d70a2653bd887ff9a8b2884a263e6a4e27f2ba68748e15530918d
35
38
  docker:
36
39
  - image: circleci/ruby:2.6
37
40
  - image: circleci/redis:4.0
@@ -40,7 +43,25 @@ jobs:
40
43
  - <<: *restore
41
44
  - <<: *bundle
42
45
  - <<: *save
46
+
47
+ - run:
48
+ name: Setup Code Climate test-reporter
49
+ command: |
50
+ # download test reporter as a static binary
51
+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
52
+ chmod +x ./cc-test-reporter
53
+
54
+ - run:
55
+ name: Code Climate before-build
56
+ command: |
57
+ ./cc-test-reporter before-build
58
+
43
59
  - <<: *unit
60
+
61
+ - run:
62
+ name: Report code coverage to Code Climate
63
+ command: |
64
+ ./cc-test-reporter after-build -t simplecov --exit-code $?
44
65
  "jruby":
45
66
  docker:
46
67
  - image: circleci/jruby:latest
data/6.0-Upgrade.md CHANGED
@@ -10,6 +10,7 @@ This release has major breaking changes. Read and test carefully in production.
10
10
  - ActiveJobs can now use `sidekiq_options` directly to configure Sidekiq
11
11
  features/internals like the retry subsystem. Prefer the native
12
12
  Sidekiq::Worker APIs as some Sidekiq features (e.g. unique jobs) do not work well with AJ.
13
+ (requires Rails 6.0.1)
13
14
  ```ruby
14
15
  class MyJob < ActiveJob::Base
15
16
  queue_as :myqueue
@@ -31,9 +32,10 @@ you can override it by configuring the log formatter explicitly. See
31
32
  ```ruby
32
33
  Sidekiq.configure_server do |config|
33
34
  config.log_formatter = AcmeCorp::PlainLogFormatter.new
34
- # config.log_formatter = Sidekiq::Logger::Format::JSON.new
35
+ # config.log_formatter = Sidekiq::Logger::Formatters::JSON.new
35
36
  end
36
37
  ```
38
+ Please see the [Logging](https://github.com/mperham/sidekiq/wiki/Logging) wiki page for the latest documentation and notes.
37
39
  - **Remove the daemonization, logfile and pidfile command line arguments and `sidekiqctl` binary**.
38
40
  I've [noted for years](https://www.mikeperham.com/2014/09/22/dont-daemonize-your-daemons/)
39
41
  how modern services should be managed with a proper init system.
data/Changes.md CHANGED
@@ -2,12 +2,92 @@
2
2
 
3
3
  [Sidekiq Changes](https://github.com/mperham/sidekiq/blob/master/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/master/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/master/Ent-Changes.md)
4
4
 
5
+ 6.0.3
6
+ ---------
7
+
8
+ - Fix `Sidekiq::Client.push_bulk` API which was erroneously putting
9
+ invalid `at` values in the job payloads [#4321]
10
+
11
+ 6.0.2
12
+ ---------
13
+
14
+ - Fix Sidekiq Enterprise's rolling restart functionality, broken by refactoring in 6.0.0. [#4334]
15
+ - More internal refactoring and performance tuning [fatkodima]
16
+
17
+ 6.0.1
18
+ ---------
19
+
20
+ - **Performance tuning**, Sidekiq should be 10-15% faster now [#4303, 4299,
21
+ 4269, fatkodima]
22
+ - **Dark Mode support in Web UI** (further design polish welcome!) [#4227, mperham,
23
+ fatkodima, silent-e]
24
+ - **Job-specific log levels**, allowing you to turn on debugging for
25
+ problematic workers. [fatkodima, #4287]
26
+ ```ruby
27
+ MyWorker.set(log_level: :debug).perform_async(...)
28
+ ```
29
+ - **Ad-hoc job tags**. You can tag your jobs with, e.g, subdomain, tenant, country,
30
+ locale, application, version, user/client, "alpha/beta/pro/ent", types of jobs,
31
+ teams/people responsible for jobs, additional metadata, etc.
32
+ Tags are shown on different pages with job listings. Sidekiq Pro users
33
+ can filter based on them [fatkodima, #4280]
34
+ ```ruby
35
+ class MyWorker
36
+ include Sidekiq::Worker
37
+ sidekiq_options tags: ['bank-ops', 'alpha']
38
+ ...
39
+ end
40
+ ```
41
+ - Fetch scheduled jobs in batches before pushing into specific queues.
42
+ This will decrease enqueueing time of scheduled jobs by a third. [fatkodima, #4273]
43
+ ```
44
+ ScheduledSet with 10,000 jobs
45
+ Before: 56.6 seconds
46
+ After: 39.2 seconds
47
+ ```
48
+ - Compress error backtraces before pushing into Redis, if you are
49
+ storing error backtraces, this will halve the size of your RetrySet
50
+ in Redis [fatkodima, #4272]
51
+ ```
52
+ RetrySet with 100,000 jobs
53
+ Before: 261 MB
54
+ After: 129 MB
55
+ ```
56
+ - Support display of ActiveJob 6.0 payloads in the Web UI [#4263]
57
+ - Add `SortedSet#scan` for pattern based scanning. For large sets this API will be **MUCH** faster
58
+ than standard iteration using each. [fatkodima, #4262]
59
+ ```ruby
60
+ Sidekiq::DeadSet.new.scan("UnreliableApi") do |job|
61
+ job.retry
62
+ end
63
+ ```
64
+ - Dramatically speed up SortedSet#find\_job(jid) by using Redis's ZSCAN
65
+ support, approx 10x faster. [fatkodima, #4259]
66
+ ```
67
+ zscan 0.179366 0.047727 0.227093 ( 1.161376)
68
+ enum 8.522311 0.419826 8.942137 ( 9.785079)
69
+ ```
70
+ - Respect rails' generators `test_framework` option and gracefully handle extra `worker` suffix on generator [fatkodima, #4256]
71
+ - Add ability to sort 'Enqueued' page on Web UI by position in the queue [fatkodima, #4248]
72
+ - Support `Client.push_bulk` with different delays [fatkodima, #4243]
73
+ ```ruby
74
+ Sidekiq::Client.push_bulk("class" => FooJob, "args" => [[1], [2]], "at" => [1.minute.from_now.to_f, 5.minutes.from_now.to_f])
75
+ ```
76
+ - Easier way to test enqueuing specific ActionMailer and ActiveRecord delayed jobs. Instead of manually
77
+ parsing embedded class, you can now test by fetching jobs for specific classes. [fatkodima, #4292]
78
+ ```ruby
79
+ assert_equal 1, Sidekiq::Extensions::DelayedMailer.jobs_for(FooMailer).size
80
+ ```
81
+ - Add `sidekiqmon` to gemspec executables [#4242]
82
+ - Gracefully handle `Sidekiq.logger = nil` [#4240]
83
+ - Inject Sidekiq::LogContext module if user-supplied logger does not include it [#4239]
84
+
5
85
  6.0
6
86
  ---------
7
87
 
8
88
  This release has major breaking changes. Read and test carefully in production.
9
89
 
10
- - ActiveJobs can now use `sidekiq_options` directly to configure Sidekiq
90
+ - With Rails 6.0.1+, ActiveJobs can now use `sidekiq_options` directly to configure Sidekiq
11
91
  features/internals like the retry subsystem. [#4213, pirj]
12
92
  ```ruby
13
93
  class MyJob < ActiveJob::Base
@@ -17,6 +97,13 @@ class MyJob < ActiveJob::Base
17
97
  end
18
98
  end
19
99
  ```
100
+ - Logging has been redesigned to allow for pluggable log formatters:
101
+ ```ruby
102
+ Sidekiq.configure_server do |config|
103
+ config.log_formatter = Sidekiq::Logger::Formatters::JSON.new
104
+ end
105
+ ```
106
+ See the [Logging wiki page](https://github.com/mperham/sidekiq/wiki/Logging) for more details.
20
107
  - **BREAKING CHANGE** Validate proper usage of the `REDIS_PROVIDER`
21
108
  variable. This variable is meant to hold the name of the environment
22
109
  variable which contains your Redis URL, so that you can switch Redis
data/Ent-Changes.md CHANGED
@@ -4,6 +4,12 @@
4
4
 
5
5
  Please see [http://sidekiq.org/](http://sidekiq.org/) for more details and how to buy.
6
6
 
7
+ 2.0.1
8
+ -------------
9
+
10
+ - Periodic job registration API adjusted to avoid loading classes in initializer [#4271]
11
+ - Remove support for deprecated ENV variables (COUNT, MAXMEM\_MB, INDEX) in swarm code
12
+
7
13
  2.0.0
8
14
  -------------
9
15
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sidekiq (6.0.0)
4
+ sidekiq (6.0.2)
5
5
  connection_pool (>= 2.2.2)
6
6
  rack (>= 2.0.0)
7
7
  rack-protection (>= 2.0.0)
@@ -97,7 +97,7 @@ GEM
97
97
  nokogiri (1.10.4)
98
98
  mini_portile2 (~> 2.4.0)
99
99
  parallel (1.17.0)
100
- parser (2.6.3.0)
100
+ parser (2.6.4.1)
101
101
  ast (~> 2.4.0)
102
102
  pry (0.12.2)
103
103
  coderay (~> 1.1.0)
@@ -164,7 +164,7 @@ GEM
164
164
  activesupport (>= 4.0)
165
165
  sprockets (>= 3.0.0)
166
166
  sqlite3 (1.4.1)
167
- standard (0.1.2)
167
+ standard (0.1.4)
168
168
  rubocop (~> 0.72.0)
169
169
  rubocop-performance (~> 1.4.0)
170
170
  thor (0.20.3)
data/Pro-Changes.md CHANGED
@@ -4,12 +4,20 @@
4
4
 
5
5
  Please see [http://sidekiq.org/](http://sidekiq.org/) for more details and how to buy.
6
6
 
7
+ 5.0.1
8
+ ---------
9
+
10
+ - Rejigger batch failures UI to add direct links to retries and scheduled jobs [#4209]
11
+ - Delete batch data with `UNLINK` [#4155]
12
+ - Fix bug where a scheduled job can lose its scheduled time when using reliable push [#4267]
13
+ - Sidekiq::JobSet#scan and #find_job APIs have been promoted to Sidekiq OSS. [#4259]
14
+
7
15
  5.0.0
8
16
  ---------
9
17
 
10
18
  - There is no significant migration from Sidekiq Pro 4.0 to 5.0
11
19
  but make sure you read the [update notes for Sidekiq
12
- 6.0](/mperham/sidekiq/blob/master/6.0-Upgrade.md).
20
+ 6.0](https://github.com/mperham/sidekiq/blob/master/6.0-Upgrade.md).
13
21
  - Removed various deprecated APIs and associated warnings.
14
22
  - **BREAKING CHANGE** Remove the `Sidekiq::Batch::Status#dead_jobs` API in favor of
15
23
  `Sidekiq::Batch::Status#dead_jids`. [#4217]
data/README.md CHANGED
@@ -3,6 +3,7 @@ Sidekiq
3
3
 
4
4
  [![Gem Version](https://badge.fury.io/rb/sidekiq.svg)](https://rubygems.org/gems/sidekiq)
5
5
  [![Code Climate](https://codeclimate.com/github/mperham/sidekiq.svg)](https://codeclimate.com/github/mperham/sidekiq)
6
+ [![Test Coverage](https://codeclimate.com/github/mperham/sidekiq/badges/coverage.svg)](https://codeclimate.com/github/mperham/sidekiq/coverage)
6
7
  [![Build Status](https://circleci.com/gh/mperham/sidekiq/tree/master.svg?style=svg)](https://circleci.com/gh/mperham/sidekiq/tree/master)
7
8
  [![Gitter Chat](https://badges.gitter.im/mperham/sidekiq.svg)](https://gitter.im/mperham/sidekiq)
8
9
 
@@ -18,7 +19,8 @@ Performance
18
19
 
19
20
  Version | Latency | Garbage created for 10k jobs | Time to process 100k jobs | Throughput | Ruby
20
21
  -----------------|------|---------|---------|------------------------|-----
21
- Sidekiq 6.0.0 | 3 ms | 156 MB | 19 sec | **5200 jobs/sec** | MRI 2.6.3
22
+ Sidekiq 6.0.2 | 3 ms | 156 MB | 14.0 sec| **7100 jobs/sec** | MRI 2.6.3
23
+ Sidekiq 6.0.0 | 3 ms | 156 MB | 19 sec | 5200 jobs/sec | MRI 2.6.3
22
24
  Sidekiq 4.0.0 | 10 ms | 151 MB | 22 sec | 4500 jobs/sec |
23
25
  Sidekiq 3.5.1 | 22 ms | 1257 MB | 125 sec | 800 jobs/sec |
24
26
  Resque 1.25.2 | - | - | 420 sec | 240 jobs/sec |
data/bin/sidekiqload CHANGED
@@ -5,7 +5,8 @@
5
5
  $TESTING = false
6
6
 
7
7
  #require 'ruby-prof'
8
- Bundler.require(:default)
8
+ require 'bundler/setup'
9
+ Bundler.require(:default, :load_test)
9
10
 
10
11
  require_relative '../lib/sidekiq/cli'
11
12
  require_relative '../lib/sidekiq/launcher'
@@ -102,17 +103,20 @@ iter.times do
102
103
  end
103
104
  Sidekiq.logger.error "Created #{count*iter} jobs"
104
105
 
106
+ start = Time.now
107
+
105
108
  Monitoring = Thread.new do
106
109
  watchdog("monitor thread") do
107
110
  while true
108
- sleep 0.5
111
+ sleep 0.2
109
112
  qsize = Sidekiq.redis do |conn|
110
113
  conn.llen "queue:default"
111
114
  end
112
115
  total = qsize
113
- Sidekiq.logger.error("RSS: #{Process.rss} Pending: #{total}")
116
+ #Sidekiq.logger.error("RSS: #{Process.rss} Pending: #{total}")
114
117
  if total == 0
115
- Sidekiq.logger.error("Done, now here's the latency for three jobs")
118
+ Sidekiq.logger.error("Done, #{iter * count} jobs in #{Time.now - start} sec")
119
+ Sidekiq.logger.error("Now here's the latency for three jobs")
116
120
 
117
121
  LoadWorker.perform_async(1, Time.now.to_f)
118
122
  LoadWorker.perform_async(2, Time.now.to_f)
data/bin/sidekiqmon CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  require 'sidekiq/monitor'
4
4
 
5
- if ARGV[0] == 'status'
6
- Sidekiq::Monitor::Status.new.display(ARGV[1])
7
- else
8
- Sidekiq::Monitor.print_usage
9
- end
5
+ section = "all"
6
+ section = ARGV[0] if ARGV.size == 1
7
+
8
+ Sidekiq::Monitor::Status.new.display(section)
@@ -16,6 +16,8 @@ module Sidekiq
16
16
  end
17
17
 
18
18
  def create_test_file
19
+ return unless test_framework
20
+
19
21
  if defined?(RSpec)
20
22
  create_worker_spec
21
23
  else
@@ -42,6 +44,14 @@ module Sidekiq
42
44
  )
43
45
  template "worker_test.rb.erb", template_file
44
46
  end
47
+
48
+ def file_name
49
+ @_file_name ||= super.sub(/_?worker\z/i, "")
50
+ end
51
+
52
+ def test_framework
53
+ ::Rails.application.config.generators.options[:rails][:test_framework]
54
+ end
45
55
  end
46
56
  end
47
57
  end