Current File : //proc/self/root/usr/lib/python3/dist-packages/botocore/retries/__pycache__/quota.cpython-312.pyc |
�
P��e� � �$ � d Z ddlZ G d� d� Zy)zRetry quota implementation.
� Nc �8 � e Zd ZdZedfd�Zd� Zd� Zed� � Zy)�
RetryQuotai� Nc �Z � || _ || _ |�t j � }|| _ y �N)�
_max_capacity�_available_capacity� threading�Lock�_lock)�self�initial_capacity�locks �8/usr/lib/python3/dist-packages/botocore/retries/quota.py�__init__zRetryQuota.__init__ s* � �-���#3�� ��<��>�>�#�D���
� c � � | j 5 || j kD r
ddd� y| xj |z c_ ddd� y# 1 sw Y yxY w)z�Attempt to aquire a certain amount of capacity.
If there's not sufficient amount of capacity available, ``False``
is returned. Otherwise, ``True`` is returned, which indicates that
capacity was successfully allocated.
NFT)r r )r �capacity_amounts r �acquirezRetryQuota.acquire sQ � � �Z�Z� ���!9�!9�9�� � �
�$�$��7�$�� � � �s �A�A�Ac �� � | j | j k( ry| j 5 t | j | j z
|� }| xj |z
c_ ddd� y# 1 sw Y yxY w)z�Release capacity back to the retry quota.
The capacity being released will be truncated if necessary
to ensure the max capacity is never exceeded.
N)r r r �min)r r �amounts r �releasezRetryQuota.release"