lib/zold/node/front.rb in zold-0.16.29 vs lib/zold/node/front.rb in zold-0.16.30
- old
+ new
@@ -70,11 +70,11 @@
set :entrance, nil # to be injected at node.rb
set :wallets, nil # to be injected at node.rb
set :remotes, nil # to be injected at node.rb
set :copies, nil # to be injected at node.rb
set :node_alias, nil # to be injected at node.rb
- set :zache, Zache.new
+ set :zache, nil # to be injected at node.rb
end
use Rack::Deflater
before do
Thread.current.thread_variable_set(:uri, request.url)
@@ -433,21 +433,23 @@
# @todo #513:30min This method is temporarily disabled since it
# takes a lot of time (when the amount of wallets is big, like 40K). However,
# we must find a way to count them somehow faster.
def total_wallets
return 256 if settings.opts['network'] == Wallet::MAINET
- settings.wallets.all.count
+ settings.zache.get(:wallets, lifetime: settings.opts['no-cache'] ? 0 : 60) do
+ settings.wallets.all.count
+ end
end
def all_remotes
- settings.zache.get(:remotes, lifetime: settings.opts['network'] == Wallet::MAINET ? 60 : 0) do
+ settings.zache.get(:remotes, lifetime: settings.opts['no-cache'] ? 0 : 60) do
settings.remotes.all
end
end
def processes_count
- settings.zache.get(:processes, lifetime: settings.opts['network'] == Wallet::MAINET ? 60 : 0) do
+ settings.zache.get(:processes, lifetime: settings.opts['no-cache'] ? 0 : 60) do
processes.count
end
end
def processes
@@ -457,10 +459,10 @@
def pretty(json)
JSON.pretty_generate(json)
end
def score
- settings.zache.get(:score, lifetime: settings.opts['network'] == Wallet::MAINET ? 60 : 0) do
+ settings.zache.get(:score, lifetime: settings.opts['no-cache'] ? 0 : 60) do
b = settings.farm.best
raise 'Score is empty, there is something wrong with the Farm!' if b.empty?
b[0]
end
end