MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //opt/alt/python35/lib/python3.5/site-packages/sentry_sdk/__pycache__/worker.cpython-35.pyc


��\�
�@s�ddlZddlmZmZddlmZmZddlmZmZddl	m
Z
e�ZGdd�de�Z
dS)�N)�Thread�Lock)�sleep�time)�queue�check_thread_support)�loggerc@s�eZdZdd�Zedd��Zdd�Zdd�Zd	d
�Zdd�Z	d
dd�Z
dd�Zdd�Zdd�Z
d
S)�BackgroundWorkercCs;t�tjd�|_t�|_d|_d|_dS)N����)rr�Queue�_queuer�_lock�_thread�_thread_for_pid)�self�r�
/worker.py�__init__s
	zBackgroundWorker.__init__cCs3|jtj�krdS|js&dS|jj�S)NF)r�os�getpidr�is_alive)rrrrrs
	zBackgroundWorker.is_alivecCs|js|j�dS)N)r�start)rrrr�_ensure_thread$s	zBackgroundWorker._ensure_threadc
Cs�t�|}|j}|jj�zHx=|jre|t�}|dkrOdS|jjd|�q)WdSWd|jj�XdS)NrF�timeoutT)rr
�all_tasks_done�acquire�unfinished_tasks�wait�release)rr�deadliner�delayrrr�_timed_queue_join)s
	

z"BackgroundWorker._timed_queue_joincCse|j�U|jsZtd|jdd�|_|jjd�|jj�tj�|_	WdQRXdS)N�target�namezraven-sentry.BackgroundWorkerT)
rrr�_targetr�	setDaemonrrrr)rrrrr8s
	
zBackgroundWorker.startc	CsMtjd�|j�0|jrB|jjt�d|_d|_WdQRXdS)Nz"background worker got kill request)r�debugrrr
�
put_nowait�_TERMINATORr)rrrr�killCs

		zBackgroundWorker.killNc
CsTtjd�|j�*|jr<|dkr<|j||�WdQRXtjd�dS)Nz#background worker got flush requestgzbackground worker flushed)rr'rr�_wait_flush)rr�callbackrrr�flushLs


zBackgroundWorker.flushcCsktd|�}|j|�sg|jj�}tjd|�|dk	rV|||�|j||�dS)Ng�������?z%d event(s) pending on flush)�minr"r
�qsizerr')rrr,Zinitial_timeout�pendingrrrr+Ts
zBackgroundWorker._wait_flushcCs|j�|jj|�dS)N)rr
r()rr,rrr�submit^s
zBackgroundWorker.submitcCsyxr|jj�}zD|tkr"Py|�Wn%tk
rTtjddd�YnXWd|jj�Xtd�qWdS)NzFailed processing job�exc_infoTr)r
�getr)�	Exceptionr�error�	task_doner)rr,rrrr%cs
zBackgroundWorker._target)�__name__�
__module__�__qualname__r�propertyrrr"rr*r-r+r1r%rrrrr	s		
r	)r�	threadingrrrrZsentry_sdk._compatrrZsentry_sdk.utilsr�objectr)r	rrrr�<module>s