From 0b55f7ff7cdd3b78bd9992063208476c1c080a02 Mon Sep 17 00:00:00 2001 From: Ernst Widerberg Date: Fri, 14 Jan 2022 11:52:04 +0100 Subject: Revert "Only retry the database connection if we get an ConnectionError exception." This reverts commit a3b5cde94981b9a98d367004b4c513c81e5870e4. --- src/main.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main.py b/src/main.py index 3a7a3c8..c3e5ad9 100755 --- a/src/main.py +++ b/src/main.py @@ -11,7 +11,6 @@ from pydantic import BaseModel from index import CouchIindex import time from db import DictDB -import requests app = FastAPI() @@ -36,9 +35,9 @@ async def mock_x_total_count_header(request: Request, call_next): for i in range(10): try: db = DictDB() - except requests.exceptions.ConnectionError: - print('Database not responding, will try again soon.' + - f'Attempt {i + 1} of 10.') + except Exception: + print( + f'Database not responding, will try again soon. Attempt {i + 1} of 10.') else: break time.sleep(10) -- cgit v1.1