Skip to content

Commit

Permalink
Merge pull request #5967 from egbertbouman/balance_cache
Browse files Browse the repository at this point in the history
Check for duplicate BalanceRequestCaches
  • Loading branch information
egbertbouman authored Jan 30, 2021
2 parents 569c26b + aca30a7 commit 0c7f76f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,12 @@ def should_join_circuit(self, create_payload, previous_node_address):
self.logger.warning("too many relays (%d)", (len(self.relay_from_to) + len(self.exit_sockets)))
return succeed(False)

# Check whether we have a random open slot, if so, allocate this to this request.
circuit_id = create_payload.circuit_id
if self.request_cache.has('balance-request', circuit_id):
self.logger.warning("balance request already in progress for circuit %d", circuit_id)
return succeed(False)

# Check whether we have a random open slot, if so, allocate this to this request.
for index, slot in enumerate(self.random_slots):
if not slot:
self.random_slots[index] = circuit_id
Expand Down

0 comments on commit 0c7f76f

Please sign in to comment.