File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -209,7 +209,21 @@ def _create_instance(cls) -> "Reaper":
209
209
container_port = int (Reaper ._container .get_exposed_port (8080 ))
210
210
211
211
Reaper ._socket = socket ()
212
- Reaper ._socket .connect ((container_host , container_port ))
212
+
213
+ last_connection_exception : Optional [ConnectionRefusedError ] = None
214
+ for _ in range (50 ):
215
+ try :
216
+ Reaper ._socket .connect ((container_host , container_port ))
217
+ last_connection_exception = None
218
+ break
219
+ except ConnectionRefusedError as e :
220
+ last_connection_exception = e
221
+ from time import sleep
222
+
223
+ sleep (0.5 )
224
+ if last_connection_exception :
225
+ raise last_connection_exception
226
+
213
227
Reaper ._socket .send (f"label={ LABEL_SESSION_ID } ={ SESSION_ID } \r \n " .encode ())
214
228
215
229
Reaper ._instance = Reaper ()
You can’t perform that action at this time.
0 commit comments