sidekiq 6.4.1 → 7.0.0
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.
- checksums.yaml +4 -4
- data/Changes.md +107 -5
- data/README.md +14 -13
- data/bin/sidekiq +3 -8
- data/bin/sidekiqload +26 -29
- data/lib/sidekiq/api.rb +232 -157
- data/lib/sidekiq/capsule.rb +110 -0
- data/lib/sidekiq/cli.rb +80 -86
- data/lib/sidekiq/client.rb +54 -42
- data/lib/sidekiq/component.rb +66 -0
- data/lib/sidekiq/config.rb +271 -0
- data/lib/sidekiq/deploy.rb +62 -0
- data/lib/sidekiq/embedded.rb +61 -0
- data/lib/sidekiq/fetch.rb +20 -19
- data/lib/sidekiq/job.rb +375 -10
- data/lib/sidekiq/job_logger.rb +1 -1
- data/lib/sidekiq/job_retry.rb +74 -53
- data/lib/sidekiq/job_util.rb +17 -11
- data/lib/sidekiq/launcher.rb +63 -69
- data/lib/sidekiq/logger.rb +6 -45
- data/lib/sidekiq/manager.rb +33 -32
- data/lib/sidekiq/metrics/query.rb +153 -0
- data/lib/sidekiq/metrics/shared.rb +95 -0
- data/lib/sidekiq/metrics/tracking.rb +134 -0
- data/lib/sidekiq/middleware/chain.rb +84 -42
- data/lib/sidekiq/middleware/current_attributes.rb +18 -17
- data/lib/sidekiq/middleware/i18n.rb +6 -4
- data/lib/sidekiq/middleware/modules.rb +21 -0
- data/lib/sidekiq/monitor.rb +1 -1
- data/lib/sidekiq/paginator.rb +10 -2
- data/lib/sidekiq/processor.rb +56 -59
- data/lib/sidekiq/rails.rb +10 -9
- data/lib/sidekiq/redis_client_adapter.rb +118 -0
- data/lib/sidekiq/redis_connection.rb +13 -82
- data/lib/sidekiq/ring_buffer.rb +29 -0
- data/lib/sidekiq/scheduled.rb +65 -37
- data/lib/sidekiq/testing/inline.rb +4 -4
- data/lib/sidekiq/testing.rb +41 -68
- data/lib/sidekiq/transaction_aware_client.rb +44 -0
- data/lib/sidekiq/version.rb +2 -1
- data/lib/sidekiq/web/action.rb +3 -3
- data/lib/sidekiq/web/application.rb +22 -6
- data/lib/sidekiq/web/csrf_protection.rb +3 -3
- data/lib/sidekiq/web/helpers.rb +21 -19
- data/lib/sidekiq/web.rb +3 -14
- data/lib/sidekiq/worker_compatibility_alias.rb +13 -0
- data/lib/sidekiq.rb +84 -207
- data/sidekiq.gemspec +29 -5
- data/web/assets/javascripts/application.js +58 -26
- data/web/assets/javascripts/base-charts.js +106 -0
- data/web/assets/javascripts/chart.min.js +13 -0
- data/web/assets/javascripts/chartjs-plugin-annotation.min.js +7 -0
- data/web/assets/javascripts/dashboard-charts.js +166 -0
- data/web/assets/javascripts/dashboard.js +3 -240
- data/web/assets/javascripts/metrics.js +236 -0
- data/web/assets/stylesheets/application-rtl.css +2 -91
- data/web/assets/stylesheets/application.css +64 -297
- data/web/locales/ar.yml +70 -70
- data/web/locales/cs.yml +62 -62
- data/web/locales/da.yml +52 -52
- data/web/locales/de.yml +65 -65
- data/web/locales/el.yml +43 -24
- data/web/locales/en.yml +82 -69
- data/web/locales/es.yml +68 -68
- data/web/locales/fa.yml +65 -65
- data/web/locales/fr.yml +67 -67
- data/web/locales/he.yml +65 -64
- data/web/locales/hi.yml +59 -59
- data/web/locales/it.yml +53 -53
- data/web/locales/ja.yml +71 -68
- data/web/locales/ko.yml +52 -52
- data/web/locales/lt.yml +66 -66
- data/web/locales/nb.yml +61 -61
- data/web/locales/nl.yml +52 -52
- data/web/locales/pl.yml +45 -45
- data/web/locales/pt-br.yml +63 -55
- data/web/locales/pt.yml +51 -51
- data/web/locales/ru.yml +67 -66
- data/web/locales/sv.yml +53 -53
- data/web/locales/ta.yml +60 -60
- data/web/locales/uk.yml +62 -61
- data/web/locales/ur.yml +64 -64
- data/web/locales/vi.yml +67 -67
- data/web/locales/zh-cn.yml +37 -11
- data/web/locales/zh-tw.yml +42 -8
- data/web/views/_footer.erb +5 -2
- data/web/views/_nav.erb +1 -1
- data/web/views/_summary.erb +1 -1
- data/web/views/busy.erb +9 -4
- data/web/views/dashboard.erb +36 -4
- data/web/views/metrics.erb +80 -0
- data/web/views/metrics_for_job.erb +69 -0
- data/web/views/queue.erb +5 -1
- metadata +69 -22
- data/lib/sidekiq/delay.rb +0 -43
- data/lib/sidekiq/exception_handler.rb +0 -27
- data/lib/sidekiq/extensions/action_mailer.rb +0 -48
- data/lib/sidekiq/extensions/active_record.rb +0 -43
- data/lib/sidekiq/extensions/class_methods.rb +0 -43
- data/lib/sidekiq/extensions/generic_proxy.rb +0 -33
- data/lib/sidekiq/util.rb +0 -108
- data/lib/sidekiq/worker.rb +0 -362
- /data/{LICENSE → LICENSE.txt} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c6762c97172b3f8e4b7cc1fd940756ee8796faf70ece8d5e9ede9e2dc7797fe
|
4
|
+
data.tar.gz: 905e0e1f381e1c40832ab2137589161fcccfb63c847ad36c9cca15765d952659
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acfc9bb74585cc65ad1af27e263668ec154ac791baa99de2a1542cfe462a7b13544a758a7bd574d623088c9e683f705437cc4e4495f05e57770037d030214a44
|
7
|
+
data.tar.gz: 31320e6cd2fab0d253f3a32616f51360c4ad6a9ef30acef5f88a6ccc6eaf75e04b76ea12dd053dd29442d96fa49234f65e14801e7600cf0f300c023d75aecf43
|
data/Changes.md
CHANGED
@@ -2,7 +2,102 @@
|
|
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
|
-
|
5
|
+
main
|
6
|
+
----------
|
7
|
+
|
8
|
+
- Embedded mode!
|
9
|
+
- Capsules!!
|
10
|
+
- Job Execution metrics!!!
|
11
|
+
- See `docs/7.0-Upgrade.md` for release notes
|
12
|
+
|
13
|
+
6-x
|
14
|
+
----------
|
15
|
+
|
16
|
+
- Add pagination to Busy page [#5556]
|
17
|
+
- Speed up WorkSet#each [#5559]
|
18
|
+
- Adjust CurrentAttributes to work with the String class name so we aren't referencing
|
19
|
+
the Class within a Rails initializer [#5536]
|
20
|
+
|
21
|
+
6.5.7
|
22
|
+
----------
|
23
|
+
|
24
|
+
- Updates for JA and ZH locales
|
25
|
+
- Further optimizations for scheduled polling [#5513]
|
26
|
+
|
27
|
+
6.5.6
|
28
|
+
----------
|
29
|
+
|
30
|
+
- Fix deprecation warnings with redis-rb 4.8.0 [#5484]
|
31
|
+
- Lock redis-rb to < 5.0 as we are moving to redis-client in Sidekiq 7.0
|
32
|
+
|
33
|
+
6.5.5
|
34
|
+
----------
|
35
|
+
|
36
|
+
- Fix require issue with job_retry.rb [#5462]
|
37
|
+
- Improve Sidekiq::Web compatibility with Rack 3.x
|
38
|
+
|
39
|
+
6.5.4
|
40
|
+
----------
|
41
|
+
|
42
|
+
- Fix invalid code on Ruby 2.5 [#5460]
|
43
|
+
- Fix further metrics dependency issues [#5457]
|
44
|
+
|
45
|
+
6.5.3
|
46
|
+
----------
|
47
|
+
|
48
|
+
- Don't require metrics code without explicit opt-in [#5456]
|
49
|
+
|
50
|
+
6.5.2
|
51
|
+
----------
|
52
|
+
|
53
|
+
- [Job Metrics are under active development, help wanted!](https://github.com/mperham/sidekiq/wiki/Metrics#contributing) **BETA**
|
54
|
+
- Add `Context` column on queue page which shows any CurrentAttributes [#5450]
|
55
|
+
- `sidekiq_retry_in` may now return `:discard` or `:kill` to dynamically stop job retries [#5406]
|
56
|
+
- Smarter sorting of processes in /busy Web UI [#5398]
|
57
|
+
- Fix broken hamburger menu in mobile UI [#5428]
|
58
|
+
- Require redis-rb 4.5.0. Note that Sidekiq will break if you use the
|
59
|
+
[`Redis.exists_returns_integer = false`](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md#450) flag. [#5394]
|
60
|
+
|
61
|
+
6.5.1
|
62
|
+
----------
|
63
|
+
|
64
|
+
- Fix `push_bulk` breakage [#5387]
|
65
|
+
|
66
|
+
6.5.0
|
67
|
+
---------
|
68
|
+
|
69
|
+
- Substantial refactoring of Sidekiq server internals, part of a larger effort
|
70
|
+
to reduce Sidekiq's internal usage of global methods and data, see [docs/global_to_local.md](docs/global_to_local.md) and [docs/middleware.md](docs/middleware.md).
|
71
|
+
- **Add beta support for the `redis-client` gem**. This will become the default Redis driver in Sidekiq 7.0. [#5298]
|
72
|
+
Read more: https://github.com/mperham/sidekiq/wiki/Using-redis-client
|
73
|
+
- **Add beta support for DB transaction-aware client** [#5291]
|
74
|
+
Add this line to your initializer and any jobs created during a transaction
|
75
|
+
will only be pushed to Redis **after the transaction commits**. You will need to add the
|
76
|
+
`after_commit_everywhere` gem to your Gemfile.
|
77
|
+
```ruby
|
78
|
+
Sidekiq.transactional_push!
|
79
|
+
```
|
80
|
+
This feature does not have a lot of production usage yet; please try it out and let us
|
81
|
+
know if you have any issues. It will be fully supported in Sidekiq 7.0 or removed if it
|
82
|
+
proves problematic.
|
83
|
+
- Fix regression with middleware arguments [#5312]
|
84
|
+
|
85
|
+
6.4.2
|
86
|
+
---------
|
87
|
+
|
88
|
+
- Strict argument checking now runs after client-side middleware [#5246]
|
89
|
+
- Fix page events with live polling [#5184]
|
90
|
+
- Many under-the-hood changes to remove all usage of the term "worker"
|
91
|
+
from the Sidekiq codebase and APIs. This mostly involved RDoc and local
|
92
|
+
variable names but a few constants and public APIs were changed. The old
|
93
|
+
APIs will be removed in Sidekiq 7.0.
|
94
|
+
```
|
95
|
+
Sidekiq::DEFAULT_WORKER_OPTIONS -> Sidekiq.default_job_options
|
96
|
+
Sidekiq.default_worker_options -> Sidekiq.default_job_options
|
97
|
+
Sidekiq::Queues["default"].jobs_by_worker(HardJob) -> Sidekiq::Queues["default"].jobs_by_class(HardJob)
|
98
|
+
```
|
99
|
+
|
100
|
+
6.4.1
|
6
101
|
---------
|
7
102
|
|
8
103
|
- Fix pipeline/multi deprecations in redis-rb 4.6
|
@@ -319,6 +414,13 @@ See the [Logging wiki page](https://github.com/mperham/sidekiq/wiki/Logging) for
|
|
319
414
|
- Integrate the StandardRB code formatter to ensure consistent code
|
320
415
|
styling. [#4114, gearnode]
|
321
416
|
|
417
|
+
5.2.10
|
418
|
+
---------
|
419
|
+
|
420
|
+
- Backport fix for CVE-2022-23837.
|
421
|
+
- Migrate to `exists?` for redis-rb.
|
422
|
+
- Lock redis-rb to <4.6 to avoid deprecations.
|
423
|
+
|
322
424
|
5.2.9
|
323
425
|
---------
|
324
426
|
|
@@ -484,7 +586,7 @@ Sidekiq::Middleware::Server::Logging -> Sidekiq::JobLogger
|
|
484
586
|
- The `SomeWorker.set(options)` API was re-written to avoid thread-local state. [#2152]
|
485
587
|
- Sidekiq Enterprise's encrypted jobs now display "[encrypted data]" in the Web UI instead
|
486
588
|
of random hex bytes.
|
487
|
-
- Please see the [5.0 Upgrade notes](5.0-Upgrade.md) for more detail.
|
589
|
+
- Please see the [5.0 Upgrade notes](docs/5.0-Upgrade.md) for more detail.
|
488
590
|
|
489
591
|
4.2.10
|
490
592
|
-----------
|
@@ -702,7 +804,7 @@ Sidekiq::Queues.clear_all
|
|
702
804
|
- Sidekiq's internals have been completely overhauled for performance
|
703
805
|
and to remove dependencies. This has resulted in major speedups, as
|
704
806
|
[detailed on my blog](http://www.mikeperham.com/2015/10/14/optimizing-sidekiq/).
|
705
|
-
- See the [4.0 upgrade notes](4.0-Upgrade.md) for more detail.
|
807
|
+
- See the [4.0 upgrade notes](docs/4.0-Upgrade.md) for more detail.
|
706
808
|
|
707
809
|
3.5.4
|
708
810
|
-----------
|
@@ -969,7 +1071,7 @@ sidekiq_options :dead => false, :retry => 5
|
|
969
1071
|
3.0.0
|
970
1072
|
-----------
|
971
1073
|
|
972
|
-
Please see [3.0-Upgrade.md](3.0-Upgrade.md) for more comprehensive upgrade notes.
|
1074
|
+
Please see [3.0-Upgrade.md](docs/3.0-Upgrade.md) for more comprehensive upgrade notes.
|
973
1075
|
|
974
1076
|
- **Dead Job Queue** - jobs which run out of retries are now moved to a dead
|
975
1077
|
job queue. These jobs must be retried manually or they will expire
|
@@ -1013,7 +1115,7 @@ Sidekiq::Client.via(ConnectionPool.new { Redis.new }) do
|
|
1013
1115
|
end
|
1014
1116
|
```
|
1015
1117
|
**Sharding support does require a breaking change to client-side
|
1016
|
-
middleware, see 3.0-Upgrade.md.**
|
1118
|
+
middleware, see docs/3.0-Upgrade.md.**
|
1017
1119
|
- New Chinese, Greek, Swedish and Czech translations for the Web UI.
|
1018
1120
|
- Updated most languages translations for the new UI features.
|
1019
1121
|
- **Remove official Capistrano integration** - this integration has been
|
data/README.md
CHANGED
@@ -27,16 +27,16 @@ This benchmark can be found in `bin/sidekiqload` and assumes a Redis network lat
|
|
27
27
|
Requirements
|
28
28
|
-----------------
|
29
29
|
|
30
|
-
- Redis:
|
31
|
-
- Ruby: MRI 2.
|
30
|
+
- Redis: 6.2+
|
31
|
+
- Ruby: MRI 2.7+ or JRuby 9.3+.
|
32
32
|
|
33
|
-
Sidekiq
|
33
|
+
Sidekiq 7.0 supports Rails 6.0+ but does not require it.
|
34
34
|
|
35
35
|
|
36
36
|
Installation
|
37
37
|
-----------------
|
38
38
|
|
39
|
-
|
39
|
+
bundle add sidekiq
|
40
40
|
|
41
41
|
|
42
42
|
Getting Started
|
@@ -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.**
|
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.
|
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 & A.
|
79
81
|
|
80
|
-
Every Friday morning is Sidekiq
|
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
|
-
|
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
|
-
|
35
|
-
|
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,21 +8,18 @@ $TESTING = false
|
|
8
8
|
require "bundler/setup"
|
9
9
|
Bundler.require(:default, :load_test)
|
10
10
|
|
11
|
-
|
12
|
-
require_relative "../lib/sidekiq/launcher"
|
13
|
-
|
14
|
-
Sidekiq.configure_server do |config|
|
15
|
-
config.options[:concurrency] = 10
|
11
|
+
x = Sidekiq.configure_embed do |config|
|
16
12
|
config.redis = {db: 13, port: 6380}
|
13
|
+
config.concurrency = 10
|
17
14
|
# config.redis = { db: 13, port: 6380, driver: :hiredis}
|
18
|
-
config.
|
15
|
+
config.queues = %w[default]
|
19
16
|
config.logger.level = Logger::ERROR
|
20
17
|
config.average_scheduled_poll_interval = 2
|
21
18
|
config.reliable! if defined?(Sidekiq::Pro)
|
22
19
|
end
|
23
20
|
|
24
21
|
class LoadWorker
|
25
|
-
include Sidekiq::
|
22
|
+
include Sidekiq::Job
|
26
23
|
sidekiq_options retry: 1
|
27
24
|
sidekiq_retry_in do |x|
|
28
25
|
1
|
@@ -36,7 +33,6 @@ end
|
|
36
33
|
|
37
34
|
# brew tap shopify/shopify
|
38
35
|
# brew install toxiproxy
|
39
|
-
# gem install toxiproxy
|
40
36
|
# run `toxiproxy-server` in a separate terminal window.
|
41
37
|
require "toxiproxy"
|
42
38
|
# simulate a non-localhost network for realer-world conditions.
|
@@ -86,16 +82,11 @@ def Process.rss
|
|
86
82
|
`ps -o rss= -p #{Process.pid}`.chomp.to_i
|
87
83
|
end
|
88
84
|
|
89
|
-
iter =
|
85
|
+
iter = 10
|
90
86
|
count = 10_000
|
91
87
|
|
92
88
|
iter.times do
|
93
|
-
arr = Array.new(count)
|
94
|
-
[]
|
95
|
-
end
|
96
|
-
count.times do |idx|
|
97
|
-
arr[idx][0] = idx
|
98
|
-
end
|
89
|
+
arr = Array.new(count) { |idx| [idx] }
|
99
90
|
Sidekiq::Client.push_bulk("class" => LoadWorker, "args" => arr)
|
100
91
|
end
|
101
92
|
Sidekiq.logger.error "Created #{count * iter} jobs"
|
@@ -103,8 +94,8 @@ Sidekiq.logger.error "Created #{count * iter} jobs"
|
|
103
94
|
start = Time.now
|
104
95
|
|
105
96
|
Monitoring = Thread.new do
|
106
|
-
|
107
|
-
sleep 0
|
97
|
+
loop do
|
98
|
+
sleep 1.0
|
108
99
|
qsize = Sidekiq.redis do |conn|
|
109
100
|
conn.llen "queue:default"
|
110
101
|
end
|
@@ -124,32 +115,38 @@ Monitoring = Thread.new do
|
|
124
115
|
end
|
125
116
|
end
|
126
117
|
|
118
|
+
def with_latency(latency, &block)
|
119
|
+
Sidekiq.logger.error "Simulating #{latency}ms of latency between Sidekiq and redis"
|
120
|
+
if latency > 0
|
121
|
+
Toxiproxy[:redis].downstream(:latency, latency: latency).apply(&block)
|
122
|
+
else
|
123
|
+
yield
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
127
|
begin
|
128
|
-
# RubyProf
|
128
|
+
# RubyProf.exclude_threads = [Monitoring]
|
129
129
|
# RubyProf.start
|
130
|
-
events = Sidekiq.options[:lifecycle_events][:startup]
|
131
|
-
events.each(&:call)
|
132
|
-
events.clear
|
133
130
|
|
134
|
-
|
135
|
-
|
136
|
-
launcher = Sidekiq::Launcher.new(Sidekiq.options)
|
137
|
-
launcher.run
|
131
|
+
with_latency(Integer(ENV.fetch("LATENCY", "1"))) do
|
132
|
+
x.run
|
138
133
|
|
139
|
-
while readable_io = IO.select([self_read])
|
134
|
+
while (readable_io = IO.select([self_read]))
|
140
135
|
signal = readable_io.first[0].gets.strip
|
141
|
-
handle_signal(
|
136
|
+
handle_signal(x, signal)
|
142
137
|
end
|
143
138
|
end
|
144
|
-
rescue SystemExit
|
139
|
+
rescue SystemExit
|
145
140
|
# Sidekiq.logger.error("Profiling...")
|
146
141
|
# result = RubyProf.stop
|
147
142
|
# printer = RubyProf::GraphHtmlPrinter.new(result)
|
148
|
-
# printer.print(File.new("output.html", "w"), :
|
143
|
+
# printer.print(File.new("output.html", "w"), min_percent: 1)
|
149
144
|
# normal
|
150
145
|
rescue => e
|
151
146
|
raise e if $DEBUG
|
152
147
|
warn e.message
|
153
148
|
warn e.backtrace.join("\n")
|
154
149
|
exit 1
|
150
|
+
ensure
|
151
|
+
x.stop
|
155
152
|
end
|