Skip to content

Commit

Permalink
[resotocore][fix] History ttl index was wrong (#1829)
Browse files Browse the repository at this point in the history
  • Loading branch information
aquamatthias committed Nov 17, 2023
1 parent e4ecab9 commit 1d842a4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions resotocore/resotocore/db/graphdb.py
Expand Up @@ -1170,8 +1170,10 @@ def create_update_collection_indexes(progress: StandardCollection, node_history:
sparse=False,
name="history_access",
)
if "ttl_index" not in node_history_indexes:
node_history.add_ttl_index(["changed"], int(timedelta(days=14).total_seconds()), name="ttl_index")
if "ttl_index" in node_history_indexes:
node_history.delete_index("ttl_index")
if "history_ttl" not in node_history_indexes:
node_history.add_ttl_index(["changed_at"], int(timedelta(days=14).total_seconds()), name="history_ttl")

def create_update_edge_indexes(edges: EdgeCollection) -> None:
edge_idxes = {idx["name"]: idx for idx in cast(List[Json], edges.indexes())}
Expand Down

0 comments on commit 1d842a4

Please sign in to comment.