HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/sentry_sdk/__pycache__/worker.cpython-37.pyc
B

Ta+�@s�ddlZddlZddlmZmZddlmZddlmZmZddl	m
Z
ddlmZddl
mZer�ddlmZdd	lmZdd
lmZe�ZGdd�de�ZdS)
�N)�sleep�time)�check_thread_support)�Queue�Full)�logger)�DEFAULT_QUEUE_SIZE)�MYPY)�Any)�Optional)�Callablec@sfeZdZefdd�Zedd��Zdd�Zdd�Zd	d
�Z	dd�Z
ddd�Zdd�Zdd�Z
dd�Zd
S)�BackgroundWorkercCs*t�t|�|_t��|_d|_d|_dS)N)rr�_queue�	threading�Lock�_lock�_thread�_thread_for_pid)�selfZ
queue_size�r�B/opt/alt/python37/lib/python3.7/site-packages/sentry_sdk/worker.py�__init__s


zBackgroundWorker.__init__cCs&|jt��krdS|jsdS|j��S)NF)r�os�getpidr�is_alive)rrrrrs
zBackgroundWorker.is_alivecCs|js|��dS)N)r�start)rrrr�_ensure_thread'szBackgroundWorker._ensure_threadcCs`t�|}|j}|j��z4x.|jrJ|t�}|dkr:dS|jj|d�qWdS|j��XdS)NrF)�timeoutT)rr�all_tasks_done�acquire�unfinished_tasks�wait�release)rrZdeadline�queue�delayrrr�_timed_queue_join,s


z"BackgroundWorker._timed_queue_joinc	CsJ|j�:|js<tj|jdd�|_d|j_|j��t�	�|_
WdQRXdS)Nzraven-sentry.BackgroundWorker)�target�nameT)rrr�Thread�_targetr�daemonrrrr)rrrrr>s
zBackgroundWorker.startc	Csbt�d�|j�H|jrTy|j�t�Wntk
rFt�d�YnXd|_d|_WdQRXdS)z�
        Kill worker thread. Returns immediately. Not useful for
        waiting on shutdown for events, use `flush` for that.
        z"background worker got kill requestz)background worker queue full, kill failedN)	r�debugrrr�
put_nowait�_TERMINATORrr)rrrr�killIs
zBackgroundWorker.killNc	CsDt�d�|j� |jr,|dkr,|�||�WdQRXt�d�dS)Nz#background worker got flush requestgzbackground worker flushed)rr+rr�_wait_flush)rr�callbackrrr�flushZs

zBackgroundWorker.flushcCsltd|�}|�|�sh|j��d}t�d|�|dk	r@|||�|�||�sh|j��d}t�d|�dS)Ng�������?�z%d event(s) pending on flushz"flush timed out, dropped %s events)�minr%r�qsizerr+�error)rrr0Zinitial_timeout�pendingrrrr/bs


zBackgroundWorker._wait_flushcCs2|��y|j�|�dStk
r,dSXdS)NTF)rrr,r)rr0rrr�submitoszBackgroundWorker.submitcCsfx`|j��}z<|tkrPy
|�Wn"tk
rDtjddd�YnXWd|j��Xtd�qWdS)NzFailed processing jobT)�exc_infor)r�getr-�	Exceptionrr5�	task_doner)rr0rrrr)xs

zBackgroundWorker._target)N)�__name__�
__module__�__qualname__rr�propertyrrr%rr.r1r/r7r)rrrrr
s	

	r
)rrrrZsentry_sdk._compatrZsentry_sdk._queuerrZsentry_sdk.utilsrZsentry_sdk.constsrZsentry_sdk._typesr	�typingr
rr�objectr-r
rrrr�<module>s