
    uYf
                     \    d dl mZ d dlmZ d dlmZ  G d de      Z G d de      Zd
d	Zy)    )absolute_import)Callable)Optionalc                       e Zd ZdZy)uWSGIConfigErrorznuWSGI configuration error.

    This is raised when uwsgi configuration is incompatible with the library.
    N__name__
__module____qualname____doc__     V/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/ddtrace/internal/uwsgi.pyr   r      s    r   r   c                       e Zd ZdZy)uWSGIMasterProcessz$The process is uWSGI master process.Nr   r   r   r   r   r      s    .r   r   Nc                 F   	 ddl }|j                  j                  d      s5t	        |j                  j                  d      xs d      sd}t        |      |j                  dkD  r|j                  j                  d      sx|j                         dk(  rd|j                  j                  d      st        d	      | 	 ddl}|j                  |        t        |dd      fd}||_        t               yyy# t        $ r Y yw xY w# t        $ r t        d
      w xY w)zCheck whetever uwsgi is running and what needs to be done.

    :param worker_callback: Callback function to call in uWSGI worker processes.
    r   Nzenable-threadsthreadszVenable-threads option must be set to true, or a positive number of threads must be set   z	lazy-appsmasterz>master option must be enabled when multiple processes are usedz:Running under uwsgi but uwsgidecorators cannot be importedatexitc                  H    	                    y y # t         $ r Y w xY w)N)	Exception)r   original_atexits   r   _atexitzcheck_uwsgi.<locals>._atexit:   s4    H #.#% / ! s    	!!)uwsgiImportErroroptgetintr   numproc	worker_iduwsgidecoratorspostforkgetattrr   r   )worker_callbackr   r   msgr"   r   r   s    `    @r   check_uwsgir'      s    IIMM*+s599==3K3Pq/Qfs## }}q{!;@QUV@Vyy}}X& ##cdd &e& $$_5%eXt<O& #EL ""; AW!;  2  e&'cddes   C< >D <	DDD )NN)	
__future__r   typingr   r   r   r   r   r'   r   r   r   <module>r*      s+    &  y / /3#r   