Skip to content

Commit

Permalink
Merge pull request #138 from IBM/bug-137
Browse files Browse the repository at this point in the history
Bug 137
  • Loading branch information
anna-riesch authored Mar 16, 2022
2 parents 8a60123 + 1654c51 commit dfe74d8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/libCli/Call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ namespace cli

// Get deadline for RPC from input or use custom
std::optional<std::chrono::time_point<std::chrono::system_clock>> deadline;
std::chrono::time_point<std::chrono::system_clock> defaultDeadline = std::chrono::system_clock::now() + std::chrono::milliseconds(10000);
std::chrono::time_point<std::chrono::system_clock> defaultDeadline = std::chrono::system_clock::now() + std::chrono::milliseconds(30000);


bool setTimeout = (parseTree.findFirstChild("rpcTimeout") != "");
Expand Down Expand Up @@ -281,7 +281,7 @@ namespace cli
std::cerr << "RPC failed ;( Status code: " << std::to_string(status.error_code()) << " " << cli::getGrpcStatusCodeAsString(status.error_code()) << ", error message: " << status.error_message() << std::endl;
if(status.error_code() == grpc::StatusCode::DEADLINE_EXCEEDED)
{
std::cerr << "Note: You can increase the deadline by setting the --rpcTimeoutInMs option to a number or 'None'." << std::endl;
std::cerr << "Note: You can increase the deadline by setting the --rpcTimeoutMilliseconds option to a number or 'None'." << std::endl;
}
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/functionTests/rpcTimeoutFunctionTest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ RPC succeeded :D
#END_TEST

#START_TEST default timeout for unary RPCs exeeded
@@CMD@@ localhost:50051 examples.StatusHandling rpcSleepForSeconds number=11
@@CMD@@ localhost:50051 examples.StatusHandling rpcSleepForSeconds number=31
/.* Deadline Exceeded
/Note:.*
#END_TEST
Expand Down
2 changes: 1 addition & 1 deletion third_party/gRPC_utils/cli_call.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ CliCall::CliCall(const std::shared_ptr<grpc::Channel>& channel,
// MODIFIED by IBM (Anna Riesch)
// original: no deadline
if (deadline.has_value()) {
// Set timelout if optional parameter has a value. Otherwise don't set timeout = infinite deadline
// Set timeout if optional parameter has a value. Otherwise don't set timeout = infinite deadline
auto deadlineMs = deadline.value();
ctx_.set_deadline(deadlineMs);
}
Expand Down

0 comments on commit dfe74d8

Please sign in to comment.