PATH:
opt
/
hc_python
/
lib
/
python3.12
/
site-packages
/
sentry_sdk
/
__pycache__
� o0i| � � � d dl Z d dlZd dlZd dlmZmZ d dlmZmZmZm Z m Z d dlmZm Z d dlmZmZmZ e rd dlmZ G d� d� Zy) � N)�datetime�timezone)�Optional�List�Callable� TYPE_CHECKING�Any)�format_timestamp� safe_repr)�Envelope�Item� PayloadRef)�Logc �R � e Zd ZdZdZdZd� Zd� Zd� Zd� Z d� Z d � Zed � � Z d� Zy) � LogBatcher�d i� g @c � � g | _ || _ || _ d| _ t j � | _ t j � | _ d | _ d | _ y )NT)�_log_buffer� _capture_func�_record_lost_func�_running� threading�Lock�_lock�Event�_flush_event�_flusher�_flusher_pid)�self�capture_func�record_lost_funcs �F/opt/hc_python/lib/python3.12/site-packages/sentry_sdk/_log_batcher.py�__init__zLogBatcher.__init__ sO � � ���)���!1����� ��^�^�%�� �%�O�O�-����� � ��� c �� � | j syt j � }| j |k( ry| j 5 | j |k( r ddd� y|| _ t j | j �� | _ d| j _ | j j � ddd� y# t $ r d| _ Y ddd� yw xY w# 1 sw Y yxY w)z�For forking processes we might need to restart this thread. This ensures that our process actually has that thread running. FTN)�target)r �os�getpidr r r �Thread�_flush_loopr �daemon�start�RuntimeError)r �pids r"