Increasing timeout for waiting for file download

This commit is contained in:
2022-02-04 11:19:50 +10:00
parent ce3d8adc5f
commit a92c836e70

View File

@@ -139,19 +139,19 @@ class Handler(watchdog.events.PatternMatchingEventHandler):
time.sleep(1) time.sleep(1)
timeout += 1 timeout += 1
if timeout > 10: if timeout > 60:
logging.error('Timeout waiting for file {} to exist. Aborting processing.'.format(event.src_path)) logging.error('Timeout waiting for file {} to exist. Aborting processing.'.format(event.src_path))
return return
historicalSize = -1 historicalSize = -1
while (historicalSize != os.path.getsize(event.src_path)): while (historicalSize != os.path.getsize(event.src_path)):
historicalSize = os.path.getsize(event.src_path)
logging.info('waiting for copy to finish....') logging.info('waiting for copy to finish....')
historicalSize = os.path.getsize(event.src_path)
time.sleep(1) time.sleep(1)
logging.info("file copy has now finished") logging.info("file copy has now finished")
with open(event.src_path, 'r') as file: with open(event.src_path, 'r') as file:
qfx = OfxParser.parse(file, fail_fast=False) qfx = OfxParser.parse(file, fail_fast=False)
statement, acct_name = Handler.get_statement_from_qfx(qfx) statement, acct_name = Handler.get_statement_from_qfx(qfx)