Cancel object location long-poll on object free. (#14165)

This commit is contained in:
Clark Zinzow 2021-02-18 15:09:43 -07:00 committed by GitHub
parent dfb86e0a8f
commit c092a5d184
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -215,15 +215,19 @@ void OwnershipBasedObjectDirectory::SubscriptionCallback(
}
}
auto worker_it = worker_rpc_clients_.find(worker_id);
rpc::GetObjectLocationsOwnerRequest request;
request.set_intended_worker_id(worker_id.Binary());
request.set_object_id(object_id.Binary());
request.set_last_version(reply.current_version());
worker_it->second->GetObjectLocationsOwner(
request,
std::bind(&OwnershipBasedObjectDirectory::SubscriptionCallback, this, object_id,
worker_id, std::placeholders::_1, std::placeholders::_2));
// Only send the next long-polling RPC if the last one was successful.
// If the last RPC failed, we consider the object to have been freed.
if (status.ok()) {
auto worker_it = worker_rpc_clients_.find(worker_id);
rpc::GetObjectLocationsOwnerRequest request;
request.set_intended_worker_id(worker_id.Binary());
request.set_object_id(object_id.Binary());
request.set_last_version(reply.current_version());
worker_it->second->GetObjectLocationsOwner(
request,
std::bind(&OwnershipBasedObjectDirectory::SubscriptionCallback, this, object_id,
worker_id, std::placeholders::_1, std::placeholders::_2));
}
}
ray::Status OwnershipBasedObjectDirectory::SubscribeObjectLocations(