File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -205,11 +205,17 @@ def _write_random_value(self) -> str:
205
205
"""Write a random value to the database."""
206
206
if not self ._database_config :
207
207
return ""
208
-
209
- with MySQLConnector (self ._database_config ) as cursor :
210
- self ._create_test_table (cursor )
211
- random_value = self ._generate_random_values (10 )
212
- self ._insert_test_data (cursor , random_value )
208
+ random_value = ""
209
+ try :
210
+ for attempt in Retrying (stop = stop_after_delay (60 ), wait = wait_fixed (5 )):
211
+ with attempt :
212
+ with MySQLConnector (self ._database_config ) as cursor :
213
+ self ._create_test_table (cursor )
214
+ random_value = self ._generate_random_values (10 )
215
+ self ._insert_test_data (cursor , random_value )
216
+ except RetryError :
217
+ logger .exception ("Unable to write to the database" )
218
+ return random_value
213
219
214
220
logger .info ("Wrote random_value" )
215
221
You can’t perform that action at this time.
0 commit comments