CCQ: Query server response channel too small (#3502)

This commit is contained in:
bruce-riley 2023-11-06 14:16:43 -06:00 committed by GitHub
parent 0c6dc18975
commit 54a8fe784b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -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?",

View File

@ -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),
}
}