yabeda-resque 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/lib/yabeda/resque/version.rb +1 -1
- data/lib/yabeda/resque.rb +16 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f8679f70e3f362a27c2e217852e5e2ca48718ba66cf4bdf929d57252dfb56726
|
|
4
|
+
data.tar.gz: ce6340bbc3f60d3c20bd6dc23fe09ff43efe44bf71bede21112d6a41905f45d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a38fd70482feffcab13f959625a426424f8b79e45cbdd7ceb2bf78b4d3df567f7ea31dd5c6b9339051cea10b0c53f9f9eaf2ca96f2457feee51a359ef8c63a65
|
|
7
|
+
data.tar.gz: 70629efcd1073097faee26feb96eb486a6baed2ebae5e41ac3716d2d67ea750abff78632e7f3c1f28f6d8b65d9e401f0dd25522095ea8259ce232c2c011aa32d
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -54,7 +54,7 @@ included in the `queue_sizes` metric. Gathering this information can be quite ex
|
|
|
54
54
|
|
|
55
55
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
56
56
|
|
|
57
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
57
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, commit it, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
58
58
|
|
|
59
59
|
## Contributing
|
|
60
60
|
|
data/lib/yabeda/resque.rb
CHANGED
|
@@ -16,6 +16,21 @@ module Yabeda
|
|
|
16
16
|
defined?(::Resque::Scheduler)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
# Pipelined alternative to Resque.count_all_scheduled_jobs from resque-scheduler.
|
|
20
|
+
# The original implementation issues a sequential LLEN call per timestamp, resulting in N round-trips to Redis.
|
|
21
|
+
# This version pipelines LLEN calls in batches to avoid blocking the Redis thread for too long,
|
|
22
|
+
# which is significantly faster when there are many delayed timestamps.
|
|
23
|
+
def count_all_scheduled_jobs_pipelined
|
|
24
|
+
timestamps = ::Resque.redis.zrange(:delayed_queue_schedule, 0, -1)
|
|
25
|
+
return 0 if timestamps.empty?
|
|
26
|
+
|
|
27
|
+
timestamps.each_slice(10_000).sum do |batch|
|
|
28
|
+
::Resque.redis.pipelined do |pipeline|
|
|
29
|
+
batch.each { |ts| pipeline.llen("delayed:#{ts}") }
|
|
30
|
+
end.sum
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
19
34
|
def jobs_processing_oldest_age(config)
|
|
20
35
|
oldest_timestamp = ::Resque.working.map { |worker| worker.job(false)["run_at"] }.min
|
|
21
36
|
return 0 if oldest_timestamp.nil?
|
|
@@ -73,7 +88,7 @@ module Yabeda
|
|
|
73
88
|
end
|
|
74
89
|
|
|
75
90
|
if ::Yabeda::Resque.monitor_delayed?
|
|
76
|
-
resque.jobs_delayed.set({}, ::Resque.
|
|
91
|
+
resque.jobs_delayed.set({}, ::Yabeda::Resque.count_all_scheduled_jobs_pipelined)
|
|
77
92
|
end
|
|
78
93
|
|
|
79
94
|
::Resque.queue_sizes.each do |queue, size|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yabeda-resque
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Josch Bockler
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-05-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: resque
|