From 474f69c1c06f5b1479915c37d06e20b5f5c51ddd Mon Sep 17 00:00:00 2001 From: Joonas Koivunen Date: Wed, 3 May 2023 10:56:49 +0300 Subject: [PATCH] fix: omit cancellation logging when panicking (#4125) noticed while describing `RequestSpan`, this fix will omit the otherwise logged message about request being cancelled when panicking in the request handler. this was missed on #4064. --- libs/utils/src/http/endpoint.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/utils/src/http/endpoint.rs b/libs/utils/src/http/endpoint.rs index b11aef9892..4bfb5bf994 100644 --- a/libs/utils/src/http/endpoint.rs +++ b/libs/utils/src/http/endpoint.rs @@ -131,7 +131,9 @@ impl RequestCancelled { impl Drop for RequestCancelled { fn drop(&mut self) { - if let Some(span) = self.warn.take() { + if std::thread::panicking() { + // we are unwinding due to panicking, assume we are not dropped for cancellation + } else if let Some(span) = self.warn.take() { // the span has all of the info already, but the outer `.instrument(span)` has already // been dropped, so we need to manually re-enter it for this message. //