summaryrefslogtreecommitdiff
path: root/database.py
diff options
context:
space:
mode:
Diffstat (limited to 'database.py')
-rw-r--r--database.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/database.py b/database.py
index 45467f6..ccb00bc 100644
--- a/database.py
+++ b/database.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
import asyncio
+import logging
import json
import asyncpg
@@ -18,14 +19,14 @@ class Database(object):
"""
while True: # retry until connection succeeds
try:
- print("attempting to connect to db…")
+ logging.warning("connecting to database")
self._pool = await asyncpg.create_pool(
host=host, port=port, user=user,
password=password, database=database)
break
except asyncpg.exceptions.CannotConnectNowError:
await self._pool.close()
- print("Database is not ready yet. Retrying…")
+ logging.error("database is not ready, retrying")
await asyncio.sleep(5)