|
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
|
@@ -179,7 +179,7 @@ def __init__(self: Self, options: Dict[str, Any]) -> None:
|
179 | 179 | Transport.__init__(self, options)
|
180 | 180 | assert self.parsed_dsn is not None
|
181 | 181 | self.options: Dict[str, Any] = options
|
182 |
| - self._worker = BackgroundWorker(queue_size=options["transport_queue_size"]) |
| 182 | + self._worker = self._create_worker(options) |
183 | 183 | self._auth = self.parsed_dsn.to_auth("sentry.python/%s" % VERSION)
|
184 | 184 | self._disabled_until: Dict[Optional[str], datetime] = {}
|
185 | 185 | # We only use this Retry() class for the `get_retry_after` method it exposes
|
@@ -230,6 +230,10 @@ def __init__(self: Self, options: Dict[str, Any]) -> None:
|
230 | 230 | elif self._compression_algo == "br":
|
231 | 231 | self._compression_level = 4
|
232 | 232 |
|
| 233 | + def _create_worker(self: Self, options: Dict[str, Any]) -> Worker: |
| 234 | + # For now, we only support the threaded sync background worker. |
| 235 | + return BackgroundWorker(queue_size=options["transport_queue_size"]) |
| 236 | + |
233 | 237 | def record_lost_event(
|
234 | 238 | self: Self,
|
235 | 239 | reason: str,
|
|
0 commit comments