Skip to content

Commit

Permalink
Address comment: possible nullptr in RedisRequestContext
Browse files Browse the repository at this point in the history
Closes: #47419
Signed-off-by: Chi-Sheng Liu <[email protected]>
  • Loading branch information
MortalHappiness committed Dec 17, 2024
1 parent 3cb06a0 commit 9779e4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 0 additions & 6 deletions src/ray/gcs/redis_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -788,12 +788,6 @@ std::unique_ptr<CallbackReply> RedisContext::RunArgvSync(

void RedisContext::RunArgvAsync(std::vector<std::string> args,
RedisCallback redis_callback) {
// redis_async_context_ is nullptr means the connection is lost because it is reset in
// the disconnect callback. If the connection is lost, we need to reconnect before
// sending the request.
if (redis_async_context_ == nullptr) {
RAY_CHECK_OK(this->Reconnect());
}
auto request_context = new RedisRequestContext(
io_service_, std::move(redis_callback), *this, std::move(args));
// RedisRequestContext is thread safe.
Expand Down
7 changes: 6 additions & 1 deletion src/ray/gcs/redis_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,12 @@ class RedisContext {
}

RedisAsyncContext &async_context() {
RAY_CHECK(redis_async_context_);
// redis_async_context_ is nullptr means the connection is lost because it is reset in
// the disconnect callback. If the connection is lost, we need to reconnect before
// sending the request.
if (redis_async_context_ == nullptr) {
RAY_CHECK_OK(this->Reconnect());
}
return *redis_async_context_;
}

Expand Down

0 comments on commit 9779e4c

Please sign in to comment.