From fd3557c5dac00d582e6370ef83fa5d263bc89b12 Mon Sep 17 00:00:00 2001 From: Erki Aas Date: Mon, 5 Feb 2024 16:04:49 +0200 Subject: [PATCH] Do not create timestamp index twice --- camdetect.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/camdetect.py b/camdetect.py index b571235..0f78cb1 100755 --- a/camdetect.py +++ b/camdetect.py @@ -558,13 +558,11 @@ async def setup_db(app, loop): app.ctx.mask = None app.ctx.db = AsyncIOMotorClient(MONGO_URI).get_default_database() app.ctx.coll = app.ctx.db[MONGO_COLLECTION] - app.ctx.coll.create_index([ - ("@timestamp", pymongo.ASCENDING)]) + app.ctx.coll.create_index( + "@timestamp", expireAfterSeconds=TTL_DAYS * 60 * 60 * 24) app.ctx.coll.create_index([ ("source", pymongo.ASCENDING), ("@timestamp", pymongo.ASCENDING)], unique=True) - app.ctx.coll.create_index( - "@timestamp", expireAfterSeconds=TTL_DAYS*60*60*24) app.ctx.last_frame = None app.ctx.event_frame = asyncio.Event() app.ctx.event_id = None