no more prints

This commit is contained in:
Benedetta 2024-03-25 15:48:56 +01:00
parent 4d7e8e64a9
commit e2812dafd8
2 changed files with 0 additions and 5 deletions

View file

@ -4,12 +4,10 @@ import datetime
TIME_FORMAT = "%Y-%m-%d %H:%M:%S" TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
async def update_last_seen(db_conn: psycopg.AsyncConnection, now: datetime.datetime): async def update_last_seen(db_conn: psycopg.AsyncConnection, now: datetime.datetime):
print('UPDATING LAST SEEN')
now_st = now.strftime(TIME_FORMAT) now_st = now.strftime(TIME_FORMAT)
query = f""" query = f"""
UPDATE kv SET store = store || '"value" => "{now_st}"' where store->'key' = 'lanonna'; UPDATE kv SET store = store || '"value" => "{now_st}"' where store->'key' = 'lanonna';
""" """
print(query)
async with db_conn.cursor() as cur: async with db_conn.cursor() as cur:
await cur.execute(query) await cur.execute(query)
@ -21,5 +19,4 @@ async def last_seen(db_conn: psycopg.AsyncConnection):
await cur.execute(query) await cur.execute(query)
tp = await cur.fetchone() tp = await cur.fetchone()
time_st = tp[0] time_st = tp[0]
print(time_st)
return datetime.datetime.strptime(time_st, TIME_FORMAT) return datetime.datetime.strptime(time_st, TIME_FORMAT)

View file

@ -15,7 +15,6 @@ logger.setLevel(logging.WARNING)
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
async def matrixmain(matrix_client: matrix.MatrixClient, mq_client: mq.MQClient, db_connection: psycopg.AsyncConnection): async def matrixmain(matrix_client: matrix.MatrixClient, mq_client: mq.MQClient, db_connection: psycopg.AsyncConnection):
from nio import RoomMessageText, MatrixRoom from nio import RoomMessageText, MatrixRoom
@ -26,7 +25,6 @@ async def matrixmain(matrix_client: matrix.MatrixClient, mq_client: mq.MQClient,
import datetime import datetime
server_timestamp = event.server_timestamp / 1000 server_timestamp = event.server_timestamp / 1000
dt_received = datetime.datetime.fromtimestamp(server_timestamp) dt_received = datetime.datetime.fromtimestamp(server_timestamp)
print(dt_received, ' >= ', last_seen)
if dt_received > last_seen: if dt_received > last_seen:
handled = await matrix.message_received_cb(matrix_client, mq_client, logger, room, event) handled = await matrix.message_received_cb(matrix_client, mq_client, logger, room, event)
if handled: if handled: