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