
    $g9                     z    d dl mZmZ erd dlmZ d dlmZ dZdddded	         fd
Zddddee	         fdZ
ddZdS )    )TYPE_CHECKINGOptional)Redis)Workerzrq:suspendedN
connectionr   workerr   c                     |                                  5 }||                    |           |                    t                     |                                d         cddd           S # 1 swxY w Y   dS )a/  Checks whether a Worker is suspendeed on a given connection
    PS: pipeline returns a list of responses
    Ref: https://github.com/andymccurdy/redis-py#pipelines

    Args:
        connection (Redis): The Redis Connection
        worker (Optional[Worker], optional): The Worker. Defaults to None.
    N)pipeline)r
   	heartbeatexistsWORKERS_SUSPENDEDexecute)r   r   r
   s      M/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/rq/suspension.pyis_suspendedr      s     
				 &(h///)***!!"%	& & & & & & & & & & & & & & & & & &s   AA..A25A2ttlc                 z    |                      t          d           ||                     t          |           dS dS )z
    Suspends.
    TTL of 0 will invalidate right away.

    Args:
        connection (Redis): The Redis connection to use..
        ttl (Optional[int], optional): time to live in seconds. Defaults to `None`
       N)setr   expire)r   r   s     r   suspendr      sB     NN$a(((
+S11111     c                 6    |                      t                    S )zW
    Resumes.

    Args:
        connection (Redis): The Redis connection to use..
    )deleter   )r   s    r   resumer   *   s     .///r   )N)r   r   )typingr   r   redisr   	rq.workerr   r   r   intr   r    r   r   <module>r!      s    * * * * * * * * !       # & &W &hx.@ & & & & 2 2 2hsm 2 2 2 20 0 0 0 0 0r   