INNER CODE UNIT · Python

wait

atenreiro/opensquat · opensquat/app.py:67

    def wait(self):
        if self._min_interval <= 0:
            return
        # Hold the lock while sleeping so slots are strictly serialized —
        # releasing early would let multiple workers read the same next_slot
        # value and pile up on identical timestamps, bursting past the limit.
        with self._lock:
            now = time.monotonic()
            if now < self._next_slot:
                time.sleep(self._next_slot - now)
                now = self._next_slot
            self._next_slot = now + self._min_interval


@dataclass
class ApiOptions:
    """Per-keyword API call options."""
    api_key: str

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…