Class: Zold::Routines::Audit

Inherits:
Object
  • Object
show all
Defined in:
lib/zold/commands/routines/audit.rb

Overview

Audit and report as much as we can to the command line.

Author

Yegor Bugayenko ([email protected])

Copyright

Copyright © 2018-2025 Zerocracy

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(opts, wallets, log: Loog::NULL) ⇒ Audit

Returns a new instance of Audit.



15
16
17
18
19
# File 'lib/zold/commands/routines/audit.rb', line 15

def initialize(opts, wallets, log: Loog::NULL)
  @opts = opts
  @wallets = wallets
  @log = log
end

Instance Method Details

#exec(_ = 0) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/zold/commands/routines/audit.rb', line 21

def exec(_ = 0)
  sleep(60) unless @opts['routine-immediately']
  msg = [
    "memory used: #{Zold::Size.new(GetProcessMem.new.bytes.to_i)}",
    "threads total: #{Thread.list.count}",
    "wallets: #{@wallets.count}"
  ].join('; ')
  @log.info("Audit: #{msg}")
end