Skip to content

Commit ef62bc0

Browse files
committed
Fix shutdown in sync mode
1 parent 3547800 commit ef62bc0

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

exporters/otlp/src/otlp_grpc_client.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -660,13 +660,13 @@ bool OtlpGrpcClient::Shutdown(OtlpGrpcClientReferenceGuard &guard,
660660
return true;
661661
}
662662

663-
#ifdef ENABLE_ASYNC_EXPORT
664663
bool last_reference_removed = RemoveReference(guard);
665664
bool force_flush_result;
666665
if (last_reference_removed && false == is_shutdown_.exchange(true, std::memory_order_acq_rel))
667666
{
668667
force_flush_result = ForceFlush(timeout);
669668

669+
#ifdef ENABLE_ASYNC_EXPORT
670670
std::unordered_set<std::shared_ptr<OtlpGrpcAsyncCallDataBase>> running_calls;
671671
{
672672
std::lock_guard<std::mutex> lock(async_data_->running_calls_lock);
@@ -679,17 +679,14 @@ bool OtlpGrpcClient::Shutdown(OtlpGrpcClientReferenceGuard &guard,
679679
call_data->grpc_context->TryCancel();
680680
}
681681
}
682+
#endif
682683
}
683684
else
684685
{
685686
force_flush_result = ForceFlush(timeout);
686687
}
687688

688689
return force_flush_result;
689-
#else
690-
RemoveReference(guard);
691-
return true;
692-
#endif
693690
}
694691

695692
} // namespace otlp

0 commit comments

Comments
 (0)