Ë
    Ìiµ  ã                   ój   — d dl Z d dlmZ d dlmZmZ d dlmZ d dlm	Z	 d dl
mZ d dlZddeded	efd
„Zy)é    N)ÚCallable)ÚRecordRetryExceptionÚRetryExternalCall)ÚConnectionError)Ú	ReadError)ÚBadGzipFileÚfnÚmax_attemptsÚattemptc                 óv  — 	  | «       S # t         j                  j                  t        t        t
        f$ r‚}||dz
  k  r^ddlm}  |t        t        |«      ¬«      «        |t        ||¬«      «       t        j                  d«       t        | ||dz   «      cY d}~S t        dt        |«      z   «      ‚d}~ww xY w)aº  Handle connection retries gracefully.

    Attempts to run a function that makes an external call, if the call fails
    on a Requests exception or decompression issue (ReadError), it will be tried
    up to 5 more times.  All exceptions that Requests explicitly raises inherit from
    requests.exceptions.RequestException.  See https://github.com/dbt-labs/dbt-core/issues/4579
    for context on this decompression issues specifically.
    é   r   )Ú
fire_event)Úexc)r   ÚmaxNz(External connection exception occurred: )ÚrequestsÚ
exceptionsÚRequestExceptionr   ÚEOFErrorr   Údbt_common.events.functionsr   r   Ústrr   ÚtimeÚsleepÚconnection_exception_retryr   )r	   r
   r   r   r   s        ú\/var/www/html/strategist-ai/venv/lib/python3.12/site-packages/dbt_common/utils/connection.pyr   r      s£   € ðYÙ‹tˆøä×Ñ×,Ñ,ÜÜÜð	ò Yð �l QÑ&Ò&å>áÔ+´°C³Ô9Ô:ÙÔ(°¸lÔKÔLÜ�J‰J�qŒMÜ-¨b°,ÀÈ!ÁÓLÕLä!Ð"LÌsÐSVËxÑ"WÓXÐXûðYús!   ‚	 ‰-B8¶A B3ÂB8ÂB3Â3B8)r   )r   Útypingr   Údbt_common.events.typesr   r   Údbt_common.exceptionsr   Útarfiler   Úgzipr   r   Úintr   © ó    r   ú<module>r#      s8   ðÛ Ý ç KÝ 1Ý Ý ã ñY 8ð Y¸3ð YÈô Yr"   