Skip to content

Commit

Permalink
Add connection success logs in database and broker modules
Browse files Browse the repository at this point in the history
Added print statements to log successful connections in both PostgreSQL and broker connection attempts. This will aid in debugging and confirming when connections are successfully established.

Signed-off-by: Jose Borreguero <[email protected]>
  • Loading branch information
jmborr committed Aug 28, 2024
1 parent f10f32a commit d8785b8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/webmonchow/amq/broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def connect_to_broker(broker, user, password, attempts=None, interval=5.0):
while attempts is None or attempt_number < attempts:
try:
conn = conn.connect(user, password, wait=True)
print(f"Connected to {broker}")
return conn
except stomp.exception.ConnectFailedException as e:
attempt_number += 1
Expand Down
1 change: 1 addition & 0 deletions src/webmonchow/pv/broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def connect_to_database(database, user, password, host, port, attempts=None, int
while attempts is None or attempt_number < attempts:
try:
conn = psycopg2.connect(database=database, user=user, password=password, host=host, port=port)
print(f"Connected to {database}")
return conn
except psycopg2.OperationalError as e:
attempt_number += 1
Expand Down

0 comments on commit d8785b8

Please sign in to comment.