Do not create timestamp index twice
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
Erki Aas 2024-02-05 16:04:49 +02:00
parent e7da187e18
commit fd3557c5da

View File

@ -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