Skip to content

Commit

Permalink
CCQ: Query server response channel too small (#3502)
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-riley authored Nov 6, 2023
1 parent 0c6dc18 commit 54a8fe7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion node/cmd/ccq/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ func runP2P(ctx context.Context, priv crypto.PrivKey, port uint, networkID, boot
Signatures: responses[requestSignature][digest],
}
delete(responses, requestSignature)
pendingResponse.ch <- s
select {
case pendingResponse.ch <- s:
logger.Debug("forwarded query response")
default:
logger.Error("failed to write query response to channel, dropping it")
}
}
} else {
logger.Warn("received observation by unknown guardian - is our guardian set outdated?",
Expand Down
3 changes: 2 additions & 1 deletion node/cmd/ccq/pending_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ type PendingResponses struct {

func NewPendingResponses() *PendingResponses {
return &PendingResponses{
pendingResponses: make(map[string]*PendingResponse),
// Make this channel bigger than the number of responses we ever expect to get for a query.
pendingResponses: make(map[string]*PendingResponse, 100),
}
}

Expand Down

0 comments on commit 54a8fe7

Please sign in to comment.