Skip to content

Commit

Permalink
#819 skip them
Browse files Browse the repository at this point in the history
  • Loading branch information
davvd committed Nov 30, 2023
1 parent 5c5c2e7 commit 497b352
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
# frozen_string_literal: true

# Copyright (c) 2018-2023 Zerocracy
#
Expand Down
6 changes: 5 additions & 1 deletion lib/zold/commands/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ def create_id(opts)
loop do
id = Id.new
return id if opts['skip-test']
found = false
found = @wallets.exists?(id)
if found
@log.debug("Wallet ID #{id} already exists locally, will try another one...")
next
end
@remotes.iterate(@log) do |r|
head = r.http("/wallet/#{id}/digest").get
found = true if head.status == 200
Expand Down
2 changes: 1 addition & 1 deletion lib/zold/hungry_wallets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def acq(id, exclusive: false)
else
@mutex.synchronize do
unless @queue.include?(id)
@missed.put(id.to_s, lifetime: 5 * 60)
@missed.put(id.to_s, true, lifetime: 5 * 60)
@queue << id
@log.debug("Hungry queue got #{id}, at the pos no.#{@queue.size - 1}")
end
Expand Down

0 comments on commit 497b352

Please sign in to comment.