This commit is contained in:
Fred Boniface 2024-03-01 22:14:06 +00:00
parent 7ca6074752
commit 0bf8f8add9

View File

@ -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'))}")