From 0bf8f8add9a1f29b97daae567b7f97b1ccc9e4a6 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Fri, 1 Mar 2024 22:14:06 +0000 Subject: [PATCH] Add logging: Ref https://git.fjla.uk/OwlBoard/backend/issues/71 --- src/main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main.py b/src/main.py index 39854ea..8f81c0e 100644 --- a/src/main.py +++ b/src/main.py @@ -54,11 +54,15 @@ timetable.runUpdate() log.out('main.py: Requesting TTL Index Creation', "INFO") mongo.createTtlIndex("users", "atime", 2629800) +registrations_ttl_seconds = 14405 try: - mongo.createTtlIndex("registrations", "time", 14400) -except: + mongo.createTtlIndex("registrations", "time", registrations_ttl_seconds) + log.out(f"main.py: createTtlIndex on 'registrations' for {registrations_ttl_seconds} seconds was successful") +except Exception as e: + log.out("main.py: createTtlIndex creation error: ", e) + log.out("main.py: Attemt to drop collection and recreate, then create index") mongo.dropCollection("registrations") - mongo.createTtlIndex("registrations", "time", 14400) + mongo.createTtlIndex("registrations", "time", registrations_ttl_seconds) log.out(f"Indexes for 'registrations': {list(mongo.listIndexes('registrations'))}")