INNER CODE UNIT · Python

_next_configuration_reload_delay

yihong1120/Construction-Hazard-Detection · main.py:299

    def _next_configuration_reload_delay(self) -> float:
        """Return the earlier of the health interval and next stream expiry."""
        delay = float(self.poll_interval)
        now = datetime.now(timezone.utc)
        for process_info in self.running_processes.values():
            raw_expiry = process_info['cfg'].get('expire_date')
            if not raw_expiry:
                continue
            try:
                expiry = datetime.fromisoformat(str(raw_expiry))
            except ValueError:
                continue
            if expiry.tzinfo is None:
                expiry = expiry.replace(tzinfo=timezone.utc)
            seconds_until_expiry = (expiry - now).total_seconds()
            if seconds_until_expiry > 0:
                delay = min(delay, seconds_until_expiry)
        return max(0.1, delay)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…