File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/timeout.cpython-310.pyc
o
�N�g# � @ s, d dl Z d dlZe �e�ZdZddd�ZdS ) � Ngffffff�?�
� � c C s� |du rt � }t�� | }t|pd|�t }|}t�� |kr@| |i |��}|r*|}nt�|� t||t�� �t }t�� |kst�� |krMt�d|| � |S )a}
Call `func` at regular intervals and Waits until the given function returns
a truthy value within the given timeout and returns that value.
@param func:
@type func: function
@param timeout:
@type timeout: int | float
@param step: Interval at which we should check for the value
@type step: int | float
@param default: Value that should be returned should `func` not return a truthy value
@type default:
@param func_args: *args for `func`
@type func_args: list | tuple
@param func_kwargs: **kwargs for `func`
@type func_kwargs: dict
@return: `default` or result of `func`
Nr z1Exceeded waiting time (%s seconds) to exectute %s)�dict�time�min�BLUR_FACTOR�sleep�log�warning) �func�timeout�step�defaultZ func_argsZfunc_kwargsZmax_time�retZcall_retr r �F/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/timeout.py�wait_for
s
�
r )r r Nr N)�loggingr � getLogger�__name__r
r r r r r r �<module> s