Remove duplicate hash table lookups in grpc_eager_client.
PiperOrigin-RevId: 280284408 Change-Id: I21727c69cccb1838158476f83b1d1c520ffb3c8b
This commit is contained in:
parent
d8bba74873
commit
a6163f12ab
@ -100,7 +100,7 @@ class GrpcEagerClient : public EagerClient {
|
||||
const auto& it = enqueue_dispatchers_.find(request->context_id());
|
||||
if (it != enqueue_dispatchers_.end()) {
|
||||
it->second.CancelCall();
|
||||
enqueue_dispatchers_.erase(request->context_id());
|
||||
enqueue_dispatchers_.erase(it);
|
||||
} else if (EnableStreaming()) {
|
||||
LOG(ERROR) << "Remote EagerContext with id " << request->context_id()
|
||||
<< " does not seem to exist.";
|
||||
@ -113,8 +113,7 @@ class GrpcEagerClient : public EagerClient {
|
||||
if (EnableStreaming()) {
|
||||
tf_shared_lock l(mu_);
|
||||
auto it = enqueue_dispatchers_.find(request->context_id());
|
||||
if (enqueue_dispatchers_.find(request->context_id()) ==
|
||||
enqueue_dispatchers_.end()) {
|
||||
if (it == enqueue_dispatchers_.end()) {
|
||||
auto it_and_bool = enqueue_dispatchers_.emplace(
|
||||
std::piecewise_construct,
|
||||
std::forward_as_tuple(request->context_id()),
|
||||
|
Loading…
Reference in New Issue
Block a user