@@ -622,15 +622,14 @@ def _get_header_value(self: Self, response: Any, header: str) -> Optional[str]:
622622
623623 async def _send_envelope (self : Self , envelope : Envelope ) -> None :
624624 _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+ )
634633 return None
635634
636635 async def _send_request (
@@ -678,7 +677,7 @@ async def _request( # type: ignore[override]
678677 },
679678 )
680679
681- def _flush_client_reports (self : Self , force : bool = False ) -> None :
680+ async def _flush_client_reports (self : Self , force : bool = False ) -> None :
682681 client_report = self ._fetch_pending_client_report (force = force , interval = 60 )
683682 if client_report is not None :
684683 self .capture_envelope (Envelope (items = [client_report ]))
@@ -687,7 +686,7 @@ async def _capture_envelope(self: Self, envelope: Envelope) -> None:
687686 async def send_envelope_wrapper () -> None :
688687 with capture_internal_exceptions ():
689688 await self ._send_envelope (envelope )
690- self ._flush_client_reports ()
689+ await self ._flush_client_reports ()
691690
692691 if not self ._worker .submit (send_envelope_wrapper ):
693692 self .on_dropped_event ("full_queue" )
@@ -713,9 +712,9 @@ def capture_envelope(self: Self, envelope: Envelope) -> None:
713712 else :
714713 # The event loop is no longer running
715714 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 " )
717716 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 )
719718
720719 def flush ( # type: ignore[override]
721720 self : Self ,
0 commit comments