Skip to content

Commit

Permalink
[core] Fix comments and a corner case in ray-project#32302 (ray-proje…
Browse files Browse the repository at this point in the history
…ct#32323)

This is a corner case where buffer could be 0 and a comments needs to be fixed in the previous PR.
  • Loading branch information
fishbone committed Feb 8, 2023
1 parent 17089dd commit 37790b3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ray/rpc/grpc_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ GrpcServer::GrpcServer(std::string name,
is_closed_(true),
num_threads_(num_threads),
keepalive_time_ms_(keepalive_time_ms) {
RAY_CHECK(num_threads_ > 0) << "Num of threads in gRPC must be greater than 0";
cqs_.resize(num_threads_);
// Enable built in health check implemented by gRPC:
// https://github.com/grpc/grpc/blob/master/doc/health-checking.md
Expand Down Expand Up @@ -148,7 +149,7 @@ void GrpcServer::Run() {
if (entry->GetMaxActiveRPCs() != -1) {
buffer_size = entry->GetMaxActiveRPCs();
}
for (int j = 0; j < (buffer_size / num_threads_); j++) {
for (int j = 0; j < std::max(1, buffer_size / num_threads_); j++) {
entry->CreateCall();
}
}
Expand Down

0 comments on commit 37790b3

Please sign in to comment.