Skip to content

Commit 6c21b82

Browse files
committed
fixup: Fix failing mongodb indexes on startup
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
1 parent 47e8387 commit 6c21b82

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

api/pubsub_mongo.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -188,19 +188,10 @@ async def _ensure_indexes(self):
188188
sub_col = self._mongo_db[self.SUBSCRIBER_STATE_COLLECTION]
189189

190190
# Event history indexes
191-
# TTL index for auto-cleanup (7 days = 604800 seconds)
192-
# Note: If index already exists with different TTL, this is a no-op.
193-
# Migration handles dropping the old index first.
194-
await event_col.create_index(
195-
'timestamp',
196-
expireAfterSeconds=604800,
197-
name='ttl_timestamp'
198-
)
199-
# Compound index for efficient pub/sub catch-up queries
200-
await event_col.create_index(
201-
[('channel', ASCENDING), ('sequence_id', ASCENDING)],
202-
name='channel_sequence_id'
203-
)
191+
# Note: Standard indexes (TTL on timestamp, channel+sequence_id) are
192+
# managed by the EventHistory model and created via db.create_indexes().
193+
# We only need to add the custom index for filtered event queries.
194+
204195
# Compound index for filtered event queries (kind + timestamp)
205196
await event_col.create_index(
206197
[('data.kind', ASCENDING), ('timestamp', ASCENDING)],

0 commit comments

Comments
 (0)