def ensure_index(cls):
collection = cls.collection()
collection.create_index(
[
("execution_id", generic.SORT_ASC),
("task_type", generic.SORT_ASC)
],
name="index_execution_id",
unique=True
)
collection.create_index(
[
("time.created", generic.SORT_ASC),
("time.started", generic.SORT_ASC),
("time.completed", generic.SORT_ASC),
("time.cancelled", generic.SORT_ASC),
("time.failed", generic.SORT_ASC)
],
name="index_time"
)
collection.create_index(
TTL_FIELDNAME,
expireAfterSeconds=0,
name="index_task_ttl"
)
评论列表
文章目录