Only hold the RefCount lock if needed (#7249)

This commit is contained in:
Stephanie Wang
2020-02-20 17:10:06 -08:00
committed by GitHub
parent 6c80071a7d
commit f27bb6eb47
+3 -1
View File
@@ -1066,7 +1066,9 @@ Status CoreWorker::ExecuteTask(const TaskSpecification &task_spec,
// return them to the caller. This will notify the caller of any IDs that we
// (or a nested task) are still borrowing. It will also any new IDs that were
// contained in a borrowed ID that we (or a nested task) are now borrowing.
reference_counter_->GetAndClearLocalBorrowers(borrowed_ids, borrowed_refs);
if (!borrowed_ids.empty()) {
reference_counter_->GetAndClearLocalBorrowers(borrowed_ids, borrowed_refs);
}
// Unpin the borrowed IDs.
std::vector<ObjectID> deleted;
for (const auto &borrowed_id : borrowed_ids) {