lib/zold/node/front.rb in zold-0.14.23 vs lib/zold/node/front.rb in zold-0.14.24

- old
+ new

@@ -23,10 +23,11 @@ STDOUT.sync = true require 'json' require 'sinatra/base' require 'webrick' +require 'get_process_mem' require 'diffy' require 'concurrent' require_relative '../backtrace' require_relative '../version' require_relative '../wallet' @@ -92,13 +93,14 @@ s = Score.parse_text(header) error(400, 'The score is invalid') unless s.valid? error(400, 'The score is weak') if s.strength < Score::STRENGTH && !settings.ignore_score_weakness if s.value > 3 require_relative '../commands/remote' - Remote.new(remotes: settings.remotes, log: settings.log).run( - ['remote', 'add', s.host, s.port.to_s, '--force', "--network=#{settings.network}"] - ) + cmd = Remote.new(remotes: settings.remotes, log: settings.log) + cmd.run(['remote', 'add', s.host, s.port.to_s, '--force', "--network=#{settings.network}"]) + cmd.run(%w[remote trim]) + cmd.run(%w[remote select]) else settings.log.debug("#{request.url}: the score is too weak: #{s}") end end end @@ -151,9 +153,10 @@ network: settings.network, protocol: settings.protocol, score: score.to_h, pid: Process.pid, cpus: Concurrent.processor_count, + memory: GetProcessMem.new.inspect.bytes, platform: RUBY_PLATFORM, uptime: `uptime`.strip, threads: "#{Thread.list.select { |t| t.status == 'run' }.count}/#{Thread.list.count}", wallets: settings.wallets.all.count, remotes: settings.remotes.all.count,