INNER CODE UNIT · Python
_deferred_startup_push
emersonfelipesp/netbox-proxbox · netbox_proxbox/__init__.py:48
def _deferred_startup_push() -> None:
"""Push existing NetBox endpoint data to the proxbox-api backend after a short delay.
Runs in a daemon thread to avoid blocking Django app initialization.
Best-effort: logs warnings on failure but never raises. This covers
the common scenario where the backend starts fresh (empty SQLite) while
the plugin already has a configured ``NetBoxEndpoint``.
"""
import time
time.sleep(10) # Give the backend time to start before the first push.
try:
from netbox_proxbox.models import NetBoxEndpoint # noqa: PLC0415
from netbox_proxbox.services.endpoint_autoconfiguration import ( # noqa: PLC0415
autoconfigure_endpoints,
)
from netbox_proxbox.services.backend_auth import ( # noqa: PLC0415