@@ -82,7 +82,7 @@ def _get_config(self, last_modified: Optional[float] = None):
8282 json_config = json .dumps (self ._config )
8383 self ._local_bucketing .store_config (json_config )
8484 if not self ._options .disable_realtime_updates :
85- if self ._sse_manager is None :
85+ if self ._sse_manager is None or not self . _sse_manager . client . is_connected () :
8686 self ._sse_manager = SSEManager (
8787 self .sse_state ,
8888 self .sse_error ,
@@ -128,6 +128,7 @@ def run(self):
128128 time .sleep (self ._options .config_polling_interval_ms / 1000.0 )
129129
130130 def sse_message (self , message : ld_eventsource .actions .Event ):
131+ # Received a message from the SSE stream but our sse_connected is False, so we need to set it to True
131132 if not self ._sse_connected :
132133 self .sse_state (None )
133134 logger .info (f"DevCycle: Received message: { message .data } " )
@@ -142,10 +143,10 @@ def sse_message(self, message: ld_eventsource.actions.Event):
142143 self ._get_config (dvc_data ["lastModified" ] / 1000.0 )
143144
144145 def sse_error (self , error : ld_eventsource .actions .Fault ):
146+ self ._sse_connected = False
145147 logger .debug (f"DevCycle: Received SSE error: { error } " )
146148
147149 def sse_state (self , state : Optional [ld_eventsource .actions .Start ]):
148- # Prevents duplicate logs when Comment events call this repeatedly
149150 if not self ._sse_connected :
150151 self ._sse_connected = True
151152 logger .info ("DevCycle: Connected to SSE stream" )
0 commit comments