MCPcopy Index your code
hub / github.com/Flagsmith/flagsmith / refresh_warehouse_connection_status

Function refresh_warehouse_connection_status

api/experimentation/services.py:730–747  ·  view source on GitHub ↗

Set a pending connection to connected when the warehouse has received at least one event. No-op otherwise.

(
    connection: WarehouseConnection,
    stats: WarehouseEventStats,
)

Source from the content-addressed store, hash-verified

728
729
730def refresh_warehouse_connection_status(
731 connection: WarehouseConnection,
732 stats: WarehouseEventStats,
733) -> WarehouseConnection:
734 """Set a pending connection to connected when the warehouse has received at
735 least one event. No-op otherwise."""
736 if (
737 connection.status == WarehouseConnectionStatus.PENDING_CONNECTION
738 and stats.total_events_received > 0
739 ):
740 connection.status = WarehouseConnectionStatus.CONNECTED
741 connection.save(update_fields=["status"])
742 logger.info(
743 "connection.connected",
744 environment__id=connection.environment_id,
745 organisation__id=connection.environment.project.organisation_id,
746 )
747 return connection
748
749
750def annotate_warehouse_event_stats(

Callers 1

Calls 1

saveMethod · 0.45

Tested by 1