Sha256: ce2ec91cf286be04060aae12b4b52bd3d0a340d34eee2dd98dec27b068b65f2a

Contents?: true

Size: 535 Bytes

Versions: 1

Compression:

Stored size: 535 Bytes

Contents

require_relative '../stdlib_ext'
require_relative 'individual'
module Sidekiq
  module Cluster
    module Memory
      class Total < Individual
        include MemoryStrategy

        def offenders
          total_ram_pct = worker_pool.map(&:memory_used_pct).sum
          worker_pool.cli.info("total RAM used by workers is #{'%.2f%%' % total_ram_pct}")
          if total_ram_pct > config.max_memory_percent
            worker_pool.sort_by(&:memory_used_pct).inverse[0..1]
          end || []
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidekiq-cluster-0.1.2 lib/sidekiq/cluster/memory/total.rb