From 334c4f02165f19cff463ececb371ae698b1eba72 Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Fri, 10 Jan 2025 11:45:20 +0100 Subject: [PATCH] [Sentry] remove deprecated hub --- .../community/errors_upload/sentry_aiohttp_transport.py | 8 +++----- .../errors_upload/test_sentry_aiohttp_transport.py | 3 --- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/octobot/community/errors_upload/sentry_aiohttp_transport.py b/octobot/community/errors_upload/sentry_aiohttp_transport.py index 8b9c77d59..83ddcaf5f 100644 --- a/octobot/community/errors_upload/sentry_aiohttp_transport.py +++ b/octobot/community/errors_upload/sentry_aiohttp_transport.py @@ -156,13 +156,11 @@ def capture_event( def capture_envelope( self, envelope: sentry_sdk.envelope.Envelope ) -> None: - hub = self.hub_cls.current async def send_envelope_wrapper() -> None: - with hub: # pylint: disable=not-context-manager - with sentry_sdk.utils.capture_internal_exceptions(): - await self._async_send_envelope(envelope) - self._flush_client_reports() + with sentry_sdk.utils.capture_internal_exceptions(): + await self._async_send_envelope(envelope) + self._flush_client_reports() if not self._worker.submit(send_envelope_wrapper): self.on_dropped_event("full_queue") diff --git a/tests/unit_tests/community/errors_upload/test_sentry_aiohttp_transport.py b/tests/unit_tests/community/errors_upload/test_sentry_aiohttp_transport.py index eca475a29..b311b2191 100644 --- a/tests/unit_tests/community/errors_upload/test_sentry_aiohttp_transport.py +++ b/tests/unit_tests/community/errors_upload/test_sentry_aiohttp_transport.py @@ -61,9 +61,6 @@ def _before_send_callback(event: dict, hint: dict): SENTRY_CONFIG["enabled"] = False if handle and hasattr(handle._client.transport, "async_kill"): await handle._client.transport.async_kill() - client = sentry_sdk.Hub.current.client - if client is not None: - client.close(timeout=0) def _mocked_context(return_value):