@@ -620,15 +620,14 @@ def _get_header_value(self: Self, response: Any, header: str) -> Optional[str]:
620
620
621
621
async def _send_envelope (self : Self , envelope : Envelope ) -> None :
622
622
_prepared_envelope = self ._prepare_envelope (envelope )
623
- if _prepared_envelope is None :
624
- return None
625
- envelope , body , headers = _prepared_envelope
626
- await self ._send_request (
627
- body .getvalue (),
628
- headers = headers ,
629
- endpoint_type = EndpointType .ENVELOPE ,
630
- envelope = envelope ,
631
- )
623
+ if _prepared_envelope is not None :
624
+ envelope , body , headers = _prepared_envelope
625
+ await self ._send_request (
626
+ body .getvalue (),
627
+ headers = headers ,
628
+ endpoint_type = EndpointType .ENVELOPE ,
629
+ envelope = envelope ,
630
+ )
632
631
return None
633
632
634
633
async def _send_request (
@@ -676,7 +675,7 @@ async def _request( # type: ignore[override]
676
675
},
677
676
)
678
677
679
- def _flush_client_reports (self : Self , force : bool = False ) -> None :
678
+ async def _flush_client_reports (self : Self , force : bool = False ) -> None :
680
679
client_report = self ._fetch_pending_client_report (force = force , interval = 60 )
681
680
if client_report is not None :
682
681
self .capture_envelope (Envelope (items = [client_report ]))
@@ -685,7 +684,7 @@ async def _capture_envelope(self: Self, envelope: Envelope) -> None:
685
684
async def send_envelope_wrapper () -> None :
686
685
with capture_internal_exceptions ():
687
686
await self ._send_envelope (envelope )
688
- self ._flush_client_reports ()
687
+ await self ._flush_client_reports ()
689
688
690
689
if not self ._worker .submit (send_envelope_wrapper ):
691
690
self .on_dropped_event ("full_queue" )
@@ -711,9 +710,9 @@ def capture_envelope(self: Self, envelope: Envelope) -> None:
711
710
else :
712
711
# The event loop is no longer running
713
712
logger .warning ("Async Transport is not running in an event loop." )
714
- self .on_dropped_event ("no_async_context " )
713
+ self .on_dropped_event ("internal_sdk_error " )
715
714
for item in envelope .items :
716
- self .record_lost_event ("no_async_context " , item = item )
715
+ self .record_lost_event ("internal_sdk_error " , item = item )
717
716
718
717
def flush ( # type: ignore[override]
719
718
self : Self ,
0 commit comments