From 3d2e5e6cbe4e6fd2554e984e8787f7db71e88dfd Mon Sep 17 00:00:00 2001 From: Alexey Zapparov Date: Thu, 5 Dec 2024 09:00:46 +0100 Subject: [PATCH] fix: Safe-navigate to session flusher (#2396) --- sentry-ruby/lib/sentry/hub.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sentry-ruby/lib/sentry/hub.rb b/sentry-ruby/lib/sentry/hub.rb index b9b58638d..d6e3ad2d0 100644 --- a/sentry-ruby/lib/sentry/hub.rb +++ b/sentry-ruby/lib/sentry/hub.rb @@ -255,7 +255,11 @@ def end_session return unless session session.close - Sentry.session_flusher.add_session(session) + + # NOTE: Under some circumstances, session_flusher nilified out of sync + # See: https://github.com/getsentry/sentry-ruby/issues/2378 + # See: https://github.com/getsentry/sentry-ruby/pull/2396 + Sentry.session_flusher&.add_session(session) end def with_session_tracking(&block)