
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
U
    „á§\É  ã                   @   sx   d dl mZ d dlZd dlmZ d dlmZ d dlmZm	Z	 d dl
mZ d dlmZ G dd	„ d	eƒZd
d„ Zdd„ ZdS )é    )Úabsolute_importN)ÚHub)ÚIntegration)Úcapture_internal_exceptionsÚevent_from_exception)ÚJobTimeoutException)ÚWorkerc                   @   s   e Zd ZdZedd„ ƒZdS )ÚRqIntegrationÚrqc                     s4   t j‰‡fdd„} | t _t j‰ ‡ fdd„}|t _d S )Nc              	      s€   t j}| t¡}|d kr*ˆ | |f|ž|ŽS | ¡ �4}| ¡  | tt 	|¡ƒ¡ ˆ | |f|ž|Ž}W 5 Q R X | j
r||j ¡  |S ©N)r   ÚcurrentÚget_integrationr	   Z
push_scopeZclear_breadcrumbsZadd_event_processorÚ_make_event_processorÚweakrefÚrefZis_horseÚclientÚflush)ÚselfÚjobÚargsÚkwargsÚhubZintegrationZscopeÚrv)Úold_perform_job© úK/opt/alt/python38/lib/python3.8/site-packages/sentry_sdk/integrations/rq.pyÚsentry_patched_perform_job    s    


z<RqIntegration.setup_once.<locals>.sentry_patched_perform_jobc                    s   t |ƒ ˆ | |f|ž|ŽS r   )Ú_capture_exception)r   r   Úexc_infor   )Úold_handle_exceptionr   r   Úsentry_patched_handle_exception9   s    zARqIntegration.setup_once.<locals>.sentry_patched_handle_exception)r   Zperform_jobZhandle_exception)r   r    r   )r   r   r   Ú
setup_once   s    zRqIntegration.setup_onceN)Ú__name__Ú
__module__Ú__qualname__Ú
identifierÚstaticmethodr!   r   r   r   r   r	      s   r	   c                    s   ‡ fdd„}|S )Nc              	      s¦   ˆ ƒ }|d k	rft ƒ � |j| d< W 5 Q R X t ƒ �0 |  di ¡}|j|j|j|j|jdœ|d< W 5 Q R X d|kr¢t ƒ �( t|d d tƒr˜dd|jg| d	< W 5 Q R X | S )
NZtransactionÚextra)Zjob_idÚfuncr   r   Údescriptionzrq-jobr   r   r
   r   Zfingerprint)	r   Ú	func_nameÚ
setdefaultÚidr   r   r)   Ú
issubclassr   )ÚeventÚhintr   r'   ©Úweak_jobr   r   Úevent_processorB   s"    ûz._make_event_processor.<locals>.event_processorr   )r1   r2   r   r0   r   r   @   s    r   c                 K   sF   t j}| t¡d krd S t| |jjdddœd�\}}|j||d� d S )Nr
   F)ÚtypeZhandled)Zclient_optionsZ	mechanism)r/   )r   r   r   r	   r   r   ÚoptionsZcapture_event)r   r   r   r.   r/   r   r   r   r   ]   s    ý
r   )Ú
__future__r   r   Zsentry_sdk.hubr   Zsentry_sdk.integrationsr   Zsentry_sdk.utilsr   r   Zrq.timeoutsr   Z	rq.workerr   ZAnyÚDictÚCallableZJobZQueueZExcInfor	   r   r   r   r   r   r   Ú<module>   s   )