summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fbin-scanner.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/fbin-scanner.py b/fbin-scanner.py
index 2653903..3dac420 100644
--- a/fbin-scanner.py
+++ b/fbin-scanner.py
@@ -135,9 +135,14 @@ def poll_loop():
now = datetime.datetime(1970, 1, 1)
next_now = datetime.datetime.utcnow()
while True:
- process_files([File.scanned == False, File.date >= now]) # noqa: E712
- now = next_now
- next_now = datetime.datetime.utcnow()
+ try:
+ process_files([File.scanned == False, File.date >= now]) # noqa: E712
+ now = next_now
+ next_now = datetime.datetime.utcnow()
+ except Exception:
+ # On errors, log the exception and retry. Don't update 'now' so that we will retry with the same files.
+ # This tends to happen eg. when we process a file but it's been deleted when we try to update it.
+ logger.exception('Error while processing files')
time.sleep(60)