@@ -620,15 +620,14 @@ def _get_header_value(self: Self, response: Any, header: str) -> Optional[str]:
620620
621621 async def _send_envelope (self : Self , envelope : Envelope ) -> None :
622622 _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+ )
632631 return None
633632
634633 async def _send_request (
@@ -676,7 +675,7 @@ async def _request( # type: ignore[override]
676675 },
677676 )
678677
679- def _flush_client_reports (self : Self , force : bool = False ) -> None :
678+ async def _flush_client_reports (self : Self , force : bool = False ) -> None :
680679 client_report = self ._fetch_pending_client_report (force = force , interval = 60 )
681680 if client_report is not None :
682681 self .capture_envelope (Envelope (items = [client_report ]))
@@ -685,7 +684,7 @@ async def _capture_envelope(self: Self, envelope: Envelope) -> None:
685684 async def send_envelope_wrapper () -> None :
686685 with capture_internal_exceptions ():
687686 await self ._send_envelope (envelope )
688- self ._flush_client_reports ()
687+ await self ._flush_client_reports ()
689688
690689 if not self ._worker .submit (send_envelope_wrapper ):
691690 self .on_dropped_event ("full_queue" )
@@ -711,9 +710,9 @@ def capture_envelope(self: Self, envelope: Envelope) -> None:
711710 else :
712711 # The event loop is no longer running
713712 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 " )
715714 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 )
717716
718717 def flush ( # type: ignore[override]
719718 self : Self ,
0 commit comments