Skip to content

Commit

Permalink
Merge pull request #81 from JuanitoFatas/memory/workers
Browse files Browse the repository at this point in the history
Simplify worker_memory calculation in get_total
  • Loading branch information
schneems committed Jan 31, 2020
2 parents 7b889f2 + 603f8fd commit 7dc7683
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Master

- Simplify workers memory calculation in PumaMemory‘s `get_total` method #81

## 0.1.1

- Allow PWK to be used with Puma 4 (#72)
Expand Down
2 changes: 1 addition & 1 deletion lib/puma_worker_killer/puma_memory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def largest_worker_memory
# Will refresh @workers
def get_total(workers = set_workers)
master_memory = GetProcessMem.new(Process.pid).mb
worker_memory = workers.map {|_, mem| mem }.inject(&:+) || 0
worker_memory = workers.values.sum
worker_memory + master_memory
end
alias :get_total_memory :get_total
Expand Down

0 comments on commit 7dc7683

Please sign in to comment.