sidekiq 6.5.8 → 7.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 (102) hide show
  1. checksums.yaml +4 -4
  2. data/Changes.md +51 -6
  3. data/{LICENSE → LICENSE.txt} +0 -0
  4. data/README.md +13 -12
  5. data/bin/sidekiq +3 -8
  6. data/bin/sidekiqload +15 -24
  7. data/lib/sidekiq/api.rb +83 -120
  8. data/lib/sidekiq/capsule.rb +126 -0
  9. data/lib/sidekiq/cli.rb +54 -72
  10. data/lib/sidekiq/client.rb +30 -17
  11. data/lib/sidekiq/component.rb +1 -0
  12. data/lib/sidekiq/config.rb +270 -0
  13. data/lib/sidekiq/deploy.rb +62 -0
  14. data/lib/sidekiq/embedded.rb +61 -0
  15. data/lib/sidekiq/fetch.rb +11 -14
  16. data/lib/sidekiq/job.rb +375 -10
  17. data/lib/sidekiq/job_logger.rb +2 -2
  18. data/lib/sidekiq/job_retry.rb +9 -9
  19. data/lib/sidekiq/job_util.rb +4 -4
  20. data/lib/sidekiq/launcher.rb +63 -60
  21. data/lib/sidekiq/logger.rb +1 -26
  22. data/lib/sidekiq/manager.rb +9 -11
  23. data/lib/sidekiq/metrics/query.rb +3 -3
  24. data/lib/sidekiq/metrics/shared.rb +4 -3
  25. data/lib/sidekiq/metrics/tracking.rb +18 -18
  26. data/lib/sidekiq/middleware/chain.rb +7 -9
  27. data/lib/sidekiq/middleware/current_attributes.rb +8 -15
  28. data/lib/sidekiq/monitor.rb +17 -2
  29. data/lib/sidekiq/paginator.rb +2 -2
  30. data/lib/sidekiq/processor.rb +17 -26
  31. data/lib/sidekiq/rails.rb +4 -9
  32. data/lib/sidekiq/redis_client_adapter.rb +8 -47
  33. data/lib/sidekiq/redis_connection.rb +11 -111
  34. data/lib/sidekiq/scheduled.rb +20 -21
  35. data/lib/sidekiq/testing.rb +5 -33
  36. data/lib/sidekiq/transaction_aware_client.rb +4 -5
  37. data/lib/sidekiq/version.rb +2 -1
  38. data/lib/sidekiq/web/application.rb +7 -4
  39. data/lib/sidekiq/web/csrf_protection.rb +1 -1
  40. data/lib/sidekiq/web/helpers.rb +17 -16
  41. data/lib/sidekiq/web.rb +6 -17
  42. data/lib/sidekiq/worker_compatibility_alias.rb +13 -0
  43. data/lib/sidekiq.rb +76 -274
  44. data/sidekiq.gemspec +15 -5
  45. data/web/assets/javascripts/application.js +18 -0
  46. data/web/assets/javascripts/base-charts.js +106 -0
  47. data/web/assets/javascripts/dashboard-charts.js +166 -0
  48. data/web/assets/javascripts/dashboard.js +3 -223
  49. data/web/assets/javascripts/metrics.js +90 -116
  50. data/web/assets/stylesheets/application-dark.css +4 -0
  51. data/web/assets/stylesheets/application-rtl.css +2 -91
  52. data/web/assets/stylesheets/application.css +23 -298
  53. data/web/locales/ar.yml +70 -70
  54. data/web/locales/cs.yml +62 -62
  55. data/web/locales/da.yml +52 -52
  56. data/web/locales/de.yml +65 -65
  57. data/web/locales/el.yml +2 -7
  58. data/web/locales/en.yml +76 -70
  59. data/web/locales/es.yml +68 -68
  60. data/web/locales/fa.yml +65 -65
  61. data/web/locales/fr.yml +67 -67
  62. data/web/locales/he.yml +65 -64
  63. data/web/locales/hi.yml +59 -59
  64. data/web/locales/it.yml +53 -53
  65. data/web/locales/ja.yml +64 -68
  66. data/web/locales/ko.yml +52 -52
  67. data/web/locales/lt.yml +66 -66
  68. data/web/locales/nb.yml +61 -61
  69. data/web/locales/nl.yml +52 -52
  70. data/web/locales/pl.yml +45 -45
  71. data/web/locales/pt-br.yml +59 -69
  72. data/web/locales/pt.yml +51 -51
  73. data/web/locales/ru.yml +67 -66
  74. data/web/locales/sv.yml +53 -53
  75. data/web/locales/ta.yml +60 -60
  76. data/web/locales/uk.yml +62 -61
  77. data/web/locales/ur.yml +64 -64
  78. data/web/locales/vi.yml +67 -67
  79. data/web/locales/zh-cn.yml +20 -18
  80. data/web/locales/zh-tw.yml +10 -1
  81. data/web/views/_footer.erb +5 -2
  82. data/web/views/_job_info.erb +18 -2
  83. data/web/views/_paging.erb +2 -0
  84. data/web/views/_poll_link.erb +1 -1
  85. data/web/views/busy.erb +36 -25
  86. data/web/views/dashboard.erb +36 -5
  87. data/web/views/metrics.erb +30 -19
  88. data/web/views/metrics_for_job.erb +17 -35
  89. data/web/views/morgue.erb +5 -9
  90. data/web/views/queue.erb +10 -14
  91. data/web/views/queues.erb +3 -1
  92. data/web/views/retries.erb +5 -9
  93. data/web/views/scheduled.erb +12 -13
  94. metadata +43 -34
  95. data/lib/sidekiq/delay.rb +0 -43
  96. data/lib/sidekiq/extensions/action_mailer.rb +0 -48
  97. data/lib/sidekiq/extensions/active_record.rb +0 -43
  98. data/lib/sidekiq/extensions/class_methods.rb +0 -43
  99. data/lib/sidekiq/extensions/generic_proxy.rb +0 -33
  100. data/lib/sidekiq/metrics/deploy.rb +0 -47
  101. data/lib/sidekiq/worker.rb +0 -370
  102. data/web/assets/javascripts/graph.js +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fde4ce1db65a0c90d5fd32cff914e33fd238e52ce2f219d03bdc4d6accbdd645
4
- data.tar.gz: fd62df7cd374ea7bf2977b44da41c771da1deb8b84046e745fb042f66060eba0
3
+ metadata.gz: 93289a9aed52b658b609cb6de99fefe182003d71bcc0102fa82fa33d53a70f5b
4
+ data.tar.gz: 1ca1b7ff222845a4a6f23ea00d77826c248a8e45db176eb9f2194afef70dface
5
5
  SHA512:
6
- metadata.gz: 1b6b3089616dbc25ce2e182ceca53c00b31b6a77adeda402b67436f1021dfc301e9f7ac2e1337e405ffdf0f6aab875fe6b228fdbceaa6e50685781cb5899e80e
7
- data.tar.gz: 37f2a103a2247c3541036044fd3ddb6e589eff483427b2f7c6ed02c6c349ec7a850c2adfdf868a22f018cf49bca3f94b65e3ecc8c46db9262c84b71c65593ddc
6
+ metadata.gz: 680961f7df970445211487780291ecc1adb738fa834126428bbb814b0b7b03e912889c66020079f24aaf548a023c9621e601631d66dd6f7f467e9f8ac5085fee
7
+ data.tar.gz: cdd1e337afbba5aaea110227e8b91e1b965e05c6ff9a5b7f5202850e3725d4d6959137dd8f47075057230451e394dca3ca0cbe5c7d70ef33ac6284a21e7fbea4
data/Changes.md CHANGED
@@ -2,14 +2,59 @@
2
2
 
3
3
  [Sidekiq Changes](https://github.com/mperham/sidekiq/blob/main/Changes.md) | [Sidekiq Pro Changes](https://github.com/mperham/sidekiq/blob/main/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/mperham/sidekiq/blob/main/Ent-Changes.md)
4
4
 
5
+ 7.0.3
6
+ ----------
7
+
8
+ - Don't warn about memory policy on Redis Enterprise [#5712]
9
+ - Don't allow Quiet/Stop on embedded Sidekiq instances [#5716]
10
+ - Fix `size: X` for configuring the default Redis pool size [#5702]
11
+ - Improve the display of queue weights on Busy page [#5642]
12
+ - Freeze CurrentAttributes on a job once initially set [#5692]
13
+
14
+ 7.0.2
15
+ ----------
16
+
17
+ - Improve compatibility with custom loggers [#5673]
18
+ - Add queue weights on Busy page [#5640]
19
+ - Add BID link on job_info page if job is part of a Batch [#5623]
20
+ - Allow custom extensions to add rows/links within Job detail pages [#5624]
21
+ ```ruby
22
+ Sidekiq::Web.custom_job_info_rows << AddAccountLink.new
23
+
24
+ class AddAccountLink
25
+ include CGI::Util
26
+ def add_pair(job)
27
+ # yield a (name, value) pair
28
+ # You can include HTML tags and CSS, Sidekiq does not do any
29
+ # escaping so beware user data injection! Note how we use CGI's
30
+ # `h` escape helper.
31
+ aid = job["account_id"]
32
+ yield "Account", "<a href='/accounts/#{h aid}'>#{h aid}</a>" if aid
33
+ end
34
+ end
35
+ ```
36
+
37
+ 7.0.1
38
+ ----------
39
+
40
+ - Allow an embedding process to reuse its own heartbeat thread
41
+ - Update zh-cn localization
42
+
43
+ 7.0.0
44
+ ----------
45
+
46
+ - Embedded mode!
47
+ - Capsules!!
48
+ - Job Execution metrics!!!
49
+ - See `docs/7.0-Upgrade.md` for release notes
50
+
5
51
  6.5.8
6
52
  ----------
7
53
 
8
54
  - Fail if using a bad version of scout_apm [#5616]
9
55
  - Add pagination to Busy page [#5556]
10
56
  - Speed up WorkSet#each [#5559]
11
- - Adjust CurrentAttributes to work with the String class name so we aren't referencing
12
- the Class within a Rails initializer [#5536]
57
+ - Adjust CurrentAttributes to work with the String class name so we aren't referencing the Class within a Rails initializer [#5536]
13
58
 
14
59
  6.5.7
15
60
  ----------
@@ -579,7 +624,7 @@ Sidekiq::Middleware::Server::Logging -> Sidekiq::JobLogger
579
624
  - The `SomeWorker.set(options)` API was re-written to avoid thread-local state. [#2152]
580
625
  - Sidekiq Enterprise's encrypted jobs now display "[encrypted data]" in the Web UI instead
581
626
  of random hex bytes.
582
- - Please see the [5.0 Upgrade notes](5.0-Upgrade.md) for more detail.
627
+ - Please see the [5.0 Upgrade notes](docs/5.0-Upgrade.md) for more detail.
583
628
 
584
629
  4.2.10
585
630
  -----------
@@ -797,7 +842,7 @@ Sidekiq::Queues.clear_all
797
842
  - Sidekiq's internals have been completely overhauled for performance
798
843
  and to remove dependencies. This has resulted in major speedups, as
799
844
  [detailed on my blog](http://www.mikeperham.com/2015/10/14/optimizing-sidekiq/).
800
- - See the [4.0 upgrade notes](4.0-Upgrade.md) for more detail.
845
+ - See the [4.0 upgrade notes](docs/4.0-Upgrade.md) for more detail.
801
846
 
802
847
  3.5.4
803
848
  -----------
@@ -1064,7 +1109,7 @@ sidekiq_options :dead => false, :retry => 5
1064
1109
  3.0.0
1065
1110
  -----------
1066
1111
 
1067
- Please see [3.0-Upgrade.md](3.0-Upgrade.md) for more comprehensive upgrade notes.
1112
+ Please see [3.0-Upgrade.md](docs/3.0-Upgrade.md) for more comprehensive upgrade notes.
1068
1113
 
1069
1114
  - **Dead Job Queue** - jobs which run out of retries are now moved to a dead
1070
1115
  job queue. These jobs must be retried manually or they will expire
@@ -1108,7 +1153,7 @@ Sidekiq::Client.via(ConnectionPool.new { Redis.new }) do
1108
1153
  end
1109
1154
  ```
1110
1155
  **Sharding support does require a breaking change to client-side
1111
- middleware, see 3.0-Upgrade.md.**
1156
+ middleware, see docs/3.0-Upgrade.md.**
1112
1157
  - New Chinese, Greek, Swedish and Czech translations for the Web UI.
1113
1158
  - Updated most languages translations for the new UI features.
1114
1159
  - **Remove official Capistrano integration** - this integration has been
File without changes
data/README.md CHANGED
@@ -27,10 +27,10 @@ This benchmark can be found in `bin/sidekiqload` and assumes a Redis network lat
27
27
  Requirements
28
28
  -----------------
29
29
 
30
- - Redis: 4.0+
31
- - Ruby: MRI 2.5+ or JRuby 9.2+.
30
+ - Redis: 6.2+
31
+ - Ruby: MRI 2.7+ or JRuby 9.3+.
32
32
 
33
- Sidekiq 6.0 supports Rails 5.0+ but does not require it.
33
+ Sidekiq 7.0 supports Rails 6.0+ but does not require it.
34
34
 
35
35
 
36
36
  Installation
@@ -52,24 +52,26 @@ Sidekiq and see its features in action. Here's the Web UI:
52
52
  Want to Upgrade?
53
53
  -------------------
54
54
 
55
+ Use `bundle up sidekiq` to upgrade Sidekiq and all its dependencies.
56
+ Upgrade notes between each major version can be found in the `docs/` directory.
57
+
55
58
  I also sell Sidekiq Pro and Sidekiq Enterprise, extensions to Sidekiq which provide more
56
59
  features, a commercial-friendly license and allow you to support high
57
60
  quality open source development all at the same time. Please see the
58
61
  [Sidekiq](https://sidekiq.org/) homepage for more detail.
59
62
 
60
- Subscribe to the **[quarterly newsletter](https://tinyletter.com/sidekiq)** to stay informed about the latest
61
- features and changes to Sidekiq and its bigger siblings.
62
-
63
63
 
64
64
  Problems?
65
65
  -----------------
66
66
 
67
- **Please do not directly email any Sidekiq committers with questions or problems.** A community is best served when discussions are held in public.
67
+ **Please do not directly email any Sidekiq committers with questions or problems.**
68
+ A community is best served when discussions are held in public.
68
69
 
69
70
  If you have a problem, please review the [FAQ](https://github.com/mperham/sidekiq/wiki/FAQ) and [Troubleshooting](https://github.com/mperham/sidekiq/wiki/Problems-and-Troubleshooting) wiki pages.
70
71
  Searching the [issues](https://github.com/mperham/sidekiq/issues) for your problem is also a good idea.
71
72
 
72
- Sidekiq Pro and Sidekiq Enterprise customers get private email support. You can purchase at https://sidekiq.org; email support@contribsys.com for help.
73
+ Sidekiq Pro and Sidekiq Enterprise customers get private email support.
74
+ You can purchase at https://sidekiq.org; email support@contribsys.com for help.
73
75
 
74
76
  Useful resources:
75
77
 
@@ -77,7 +79,7 @@ Useful resources:
77
79
  * Occasional announcements are made to the [@sidekiq](https://twitter.com/sidekiq) Twitter account.
78
80
  * The [Sidekiq tag](https://stackoverflow.com/questions/tagged/sidekiq) on Stack Overflow has lots of useful Q &amp; A.
79
81
 
80
- Every Friday morning is Sidekiq happy hour: I video chat and answer questions.
82
+ Every Friday morning is Sidekiq office hour: I video chat and answer questions.
81
83
  See the [Sidekiq support page](https://sidekiq.org/support.html) for details.
82
84
 
83
85
  Contributing
@@ -85,12 +87,11 @@ Contributing
85
87
 
86
88
  Please see [the contributing guidelines](https://github.com/mperham/sidekiq/blob/main/.github/contributing.md).
87
89
 
88
-
89
90
  License
90
91
  -----------------
91
92
 
92
- Please see [LICENSE](https://github.com/mperham/sidekiq/blob/main/LICENSE) for licensing details.
93
-
93
+ Please see [LICENSE.txt](https://github.com/mperham/sidekiq/blob/main/LICENSE.txt) for licensing details.
94
+ The license for Sidekiq Pro and Sidekiq Enterprise can be found in [COMM-LICENSE.txt](https://github.com/mperham/sidekiq/blob/main/COMM-LICENSE.txt).
94
95
 
95
96
  Author
96
97
  -----------------
data/bin/sidekiq CHANGED
@@ -10,7 +10,7 @@ def integrate_with_systemd
10
10
  return unless ENV["NOTIFY_SOCKET"]
11
11
 
12
12
  Sidekiq.configure_server do |config|
13
- Sidekiq.logger.info "Enabling systemd notification integration"
13
+ config.logger.info "Enabling systemd notification integration"
14
14
  require "sidekiq/sd_notify"
15
15
  config.on(:startup) do
16
16
  Sidekiq::SdNotify.ready
@@ -31,12 +31,7 @@ begin
31
31
  cli.run
32
32
  rescue => e
33
33
  raise e if $DEBUG
34
- if Sidekiq.error_handlers.length == 0
35
- warn e.message
36
- warn e.backtrace.join("\n")
37
- else
38
- cli.handle_exception e
39
- end
40
-
34
+ warn e.message
35
+ warn e.backtrace.join("\n")
41
36
  exit 1
42
37
  end
data/bin/sidekiqload CHANGED
@@ -8,25 +8,18 @@ $TESTING = false
8
8
  require "bundler/setup"
9
9
  Bundler.require(:default, :load_test)
10
10
 
11
- require_relative "../lib/sidekiq/cli"
12
- require_relative "../lib/sidekiq/launcher"
13
-
14
- if ENV["SIDEKIQ_REDIS_CLIENT"]
15
- Sidekiq::RedisConnection.adapter = :redis_client
16
- end
17
-
18
- Sidekiq.configure_server do |config|
19
- config.options[:concurrency] = 10
11
+ x = Sidekiq.configure_embed do |config|
20
12
  config.redis = {db: 13, port: 6380}
13
+ config.concurrency = 10
21
14
  # config.redis = { db: 13, port: 6380, driver: :hiredis}
22
- config.options[:queues] << "default"
15
+ config.queues = %w[default]
23
16
  config.logger.level = Logger::ERROR
24
17
  config.average_scheduled_poll_interval = 2
25
18
  config.reliable! if defined?(Sidekiq::Pro)
26
19
  end
27
20
 
28
21
  class LoadWorker
29
- include Sidekiq::Worker
22
+ include Sidekiq::Job
30
23
  sidekiq_options retry: 1
31
24
  sidekiq_retry_in do |x|
32
25
  1
@@ -101,8 +94,8 @@ Sidekiq.logger.error "Created #{count * iter} jobs"
101
94
  start = Time.now
102
95
 
103
96
  Monitoring = Thread.new do
104
- while true
105
- sleep 0.2
97
+ loop do
98
+ sleep 1.0
106
99
  qsize = Sidekiq.redis do |conn|
107
100
  conn.llen "queue:default"
108
101
  end
@@ -132,30 +125,28 @@ def with_latency(latency, &block)
132
125
  end
133
126
 
134
127
  begin
135
- # RubyProf::exclude_threads = [ Monitoring ]
128
+ # RubyProf.exclude_threads = [Monitoring]
136
129
  # RubyProf.start
137
- events = Sidekiq.options[:lifecycle_events][:startup]
138
- events.each(&:call)
139
- events.clear
140
-
130
+
141
131
  with_latency(Integer(ENV.fetch("LATENCY", "1"))) do
142
- launcher = Sidekiq::Launcher.new(Sidekiq)
143
- launcher.run
132
+ x.run
144
133
 
145
- while readable_io = IO.select([self_read])
134
+ while (readable_io = IO.select([self_read]))
146
135
  signal = readable_io.first[0].gets.strip
147
- handle_signal(launcher, signal)
136
+ handle_signal(x, signal)
148
137
  end
149
138
  end
150
- rescue SystemExit => e
139
+ rescue SystemExit
151
140
  # Sidekiq.logger.error("Profiling...")
152
141
  # result = RubyProf.stop
153
142
  # printer = RubyProf::GraphHtmlPrinter.new(result)
154
- # printer.print(File.new("output.html", "w"), :min_percent => 1)
143
+ # printer.print(File.new("output.html", "w"), min_percent: 1)
155
144
  # normal
156
145
  rescue => e
157
146
  raise e if $DEBUG
158
147
  warn e.message
159
148
  warn e.backtrace.join("\n")
160
149
  exit 1
150
+ ensure
151
+ x.stop
161
152
  end