Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new function, CallSingleChannel, for what appears to be testing purposes, given the 'DONOTMERGE' title. The function establishes a gRPC connection and continuously sends requests. My review identifies a couple of areas for improvement: a misleading comment and a missing backoff mechanism in an error handling path, which could lead to high CPU usage.
| log.Printf("[Worker %d] Prime() failed: %v", workerID, err) | ||
| // Tiny backoff to prevent CPU thrashing if the connection fully drops |
There was a problem hiding this comment.
The comment on line 173 indicates an intention to add a backoff, but it's not implemented. Without a backoff, the loop could spin and consume high CPU if Prime() fails repeatedly. This suggestion adds a small time.Sleep() to implement the backoff as intended.
| log.Printf("[Worker %d] Prime() failed: %v", workerID, err) | |
| // Tiny backoff to prevent CPU thrashing if the connection fully drops | |
| log.Printf("[Worker %d] Prime() failed: %v", workerID, err) | |
| time.Sleep(100 * time.Millisecond) // Tiny backoff to prevent CPU thrashing if the connection fully drops |
| } | ||
|
|
||
| // CallSingleChannel connects to Bigtable using the DirectPath C2P scheme, | ||
| // and continuously maintains 200 in-flight Prime requests on the same channel |
There was a problem hiding this comment.
The function comment hardcodes '200' as the number of in-flight requests. However, this is determined by the requestsInFlight parameter. The comment should be updated to reflect that this value is configurable to avoid confusion.
| // and continuously maintains 200 in-flight Prime requests on the same channel | |
| // and continuously maintains a configurable number of in-flight Prime requests on the same channel |
No description provided.