summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErnst Widerberg <ernst@sunet.se>2022-01-14 11:52:04 +0100
committerErnst Widerberg <ernst@sunet.se>2022-01-14 11:52:04 +0100
commit0b55f7ff7cdd3b78bd9992063208476c1c080a02 (patch)
treef8da37a9bbbcaf45f9c5df2b253ec884847b98a0
parent98c83a8c25f75672e3e38bd522d722dbf3279273 (diff)
Revert "Only retry the database connection if we get an ConnectionError exception."
This reverts commit a3b5cde94981b9a98d367004b4c513c81e5870e4.
-rwxr-xr-xsrc/main.py7
1 files 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)