|
28 | 28 |
|
29 | 29 | from sentry_sdk.consts import EndpointType |
30 | 30 | from sentry_sdk.utils import Dsn, logger, capture_internal_exceptions |
31 | | -from sentry_sdk.worker import BackgroundWorker |
| 31 | +from sentry_sdk.worker import BackgroundWorker, Worker |
32 | 32 | from sentry_sdk.envelope import Envelope, Item, PayloadRef |
33 | 33 |
|
34 | 34 | from typing import TYPE_CHECKING |
@@ -173,7 +173,7 @@ def __init__(self: Self, options: Dict[str, Any]) -> None: |
173 | 173 | Transport.__init__(self, options) |
174 | 174 | assert self.parsed_dsn is not None |
175 | 175 | self.options: Dict[str, Any] = options |
176 | | - self._worker = BackgroundWorker(queue_size=options["transport_queue_size"]) |
| 176 | + self._worker = self._create_worker(options) |
177 | 177 | self._auth = self.parsed_dsn.to_auth("sentry.python/%s" % VERSION) |
178 | 178 | self._disabled_until: Dict[Optional[str], datetime] = {} |
179 | 179 | # We only use this Retry() class for the `get_retry_after` method it exposes |
@@ -224,6 +224,10 @@ def __init__(self: Self, options: Dict[str, Any]) -> None: |
224 | 224 | elif self._compression_algo == "br": |
225 | 225 | self._compression_level = 4 |
226 | 226 |
|
| 227 | + def _create_worker(self: Self, options: Dict[str, Any]) -> Worker: |
| 228 | + # For now, we only support the threaded sync background worker. |
| 229 | + return BackgroundWorker(queue_size=options["transport_queue_size"]) |
| 230 | + |
227 | 231 | def record_lost_event( |
228 | 232 | self: Self, |
229 | 233 | reason: str, |
|
0 commit comments