File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,8 @@ def initialize
27
27
28
28
raindrops_stats = Raindrops ::Stats . new
29
29
30
- @active_workers = raindrops_stats . active_workers
31
- @queued_requests = raindrops_stats . queued_requests
30
+ @active_workers = raindrops_stats . active_workers || 0
31
+ @queued_requests = raindrops_stats . queued_requests || 0
32
32
end
33
33
34
34
def instrument
@@ -47,16 +47,13 @@ def self.instrument
47
47
attr_reader :workers_count , :live_workers_count , :active_workers , :queued_requests
48
48
49
49
def capacity
50
- return 0 if live_workers_count . nil? || active_workers . nil?
51
- return 0 if live_workers_count &.zero?
52
- return 0 if active_workers &.zero?
50
+ return 0 if live_workers_count . nil? || live_workers_count . zero?
53
51
54
52
live_workers_count - active_workers
55
53
end
56
54
57
55
def busy_percent
58
- return 100 if live_workers_count . zero?
59
- return 100 if active_workers &.zero?
56
+ return 0 if live_workers_count . zero?
60
57
61
58
( active_workers . to_f / live_workers_count ) * 100
62
59
end
You can’t perform that action at this time.
0 commit comments