@@ -281,7 +281,7 @@ def open(self, file_path, mode):
281
281
try :
282
282
return open (real_path , mode )
283
283
except Exception as error :
284
- if i < Constants .MAX_FILE_OPERATION_RETRY_COUNT - 1 :
284
+ if i < Constants .MAX_FILE_OPERATION_RETRY_COUNT :
285
285
time .sleep (i + 1 )
286
286
else :
287
287
raise Exception ("Unable to open {0} (retries exhausted). Error: {1}." .format (str (real_path ), repr (error )))
@@ -310,7 +310,7 @@ def read_with_retry(self, file_path_or_handle):
310
310
self .__write_record (operation , code = 0 , output = value , delay = 0 )
311
311
return value
312
312
except Exception as error :
313
- if i < Constants .MAX_FILE_OPERATION_RETRY_COUNT - 1 :
313
+ if i < Constants .MAX_FILE_OPERATION_RETRY_COUNT :
314
314
time .sleep (i + 1 )
315
315
else :
316
316
raise Exception ("Unable to read from {0} (retries exhausted). Error: {1}." .format (str (file_path_or_handle ), repr (error )))
@@ -327,7 +327,7 @@ def write_with_retry(self, file_path_or_handle, data, mode='a+'):
327
327
file_handle .write (str (data ))
328
328
break
329
329
except Exception as error :
330
- if i < Constants .MAX_FILE_OPERATION_RETRY_COUNT - 1 :
330
+ if i < Constants .MAX_FILE_OPERATION_RETRY_COUNT :
331
331
time .sleep (i + 1 )
332
332
else :
333
333
raise Exception ("Unable to write to {0} (retries exhausted). Error: {1}." .format (str (file_handle .name ), repr (error )))
@@ -346,7 +346,7 @@ def write_with_retry_using_temp_file(file_path, data, mode='w'):
346
346
shutil .move (tempname , file_path )
347
347
break
348
348
except Exception as error :
349
- if i < Constants .MAX_FILE_OPERATION_RETRY_COUNT - 1 :
349
+ if i < Constants .MAX_FILE_OPERATION_RETRY_COUNT :
350
350
time .sleep (i + 1 )
351
351
else :
352
352
raise Exception ("Unable to write to {0} (retries exhausted). Error: {1}." .format (str (file_path ), repr (error )))
0 commit comments