lib/zold/commands/push.rb in zold-0.16.24 vs lib/zold/commands/push.rb in zold-0.16.25
- old
+ new
@@ -85,17 +85,17 @@
if opts['ignore-node'].include?(r.to_s)
@log.debug("#{r} ignored because of --ignore-node")
return 0
end
start = Time.now
- content = @wallets.find(id) do |wallet|
+ content = @wallets.acq(id) do |wallet|
raise "The wallet #{id} is absent" unless wallet.exists?
IO.read(wallet.path)
end
uri = "/wallet/#{id}"
response = r.http(uri).put(content, timeout: 2 + content.length * 0.01 / 1024)
- @wallets.find(id) do |wallet|
- if response.code == '304'
+ @wallets.acq(id) do |wallet|
+ if response.status == 304
@log.info("#{r}: same version of #{wallet.mnemo} there, in #{Age.new(start, limit: 0.5)}")
return 0
end
r.assert_code(200, response)
json = JsonPage.new(response.body, uri).to_hash