SXXXXXXX_FlightMonitor/flightmonitor/data/data_constants.py
2025-06-11 09:39:42 +02:00

30 lines
981 B
Python

# FlightMonitor/data/data_constants.py
"""
Defines shared constants for the data layer, such as message types and status codes,
to prevent circular dependencies between modules.
"""
# Common name for the data provider
PROVIDER_NAME_OPENSKY = "OpenSkyNetwork"
# --- Adapter Message Types ---
# Defines the 'type' key in the messages passed through the queues.
MSG_TYPE_FLIGHT_DATA = "flight_data"
MSG_TYPE_ADAPTER_STATUS = "adapter_status"
# --- Adapter Status Codes ---
# Defines the 'status_code' for status messages.
STATUS_STARTING = "STARTING"
STATUS_FETCHING = "FETCHING"
STATUS_STOPPING = "STOPPING"
STATUS_STOPPED = "STOPPED"
STATUS_RECOVERED = "RECOVERED"
STATUS_RATE_LIMITED = "RATE_LIMITED"
STATUS_API_ERROR_TEMPORARY = "API_ERROR_TEMPORARY"
STATUS_PERMANENT_FAILURE = "PERMANENT_FAILURE"
# --- Backoff Strategy Constants for Adapters ---
INITIAL_BACKOFF_DELAY_SECONDS = 20.0
MAX_BACKOFF_DELAY_SECONDS = 300.0
BACKOFF_FACTOR = 1.8
MAX_CONSECUTIVE_ERRORS_THRESHOLD = 5