Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add timeout to graph queries #157

Open
SHAcollision opened this issue Oct 12, 2024 · 0 comments · May be fixed by #215
Open

Feat: add timeout to graph queries #157

SHAcollision opened this issue Oct 12, 2024 · 0 comments · May be fixed by #215
Assignees
Labels
enhancement New feature or request 🔮 nexus

Comments

@SHAcollision
Copy link
Collaborator

SHAcollision commented Oct 12, 2024

Description:

We have started to make queries to the get_from_graph function in the PostStream model. it fetches posts streams from Neo4J without a timeout. Right now it is super fast, but as the network grows some queries will take longer. We need to introduce timeout handling to ensure that long-running queries do not affect the performance and responsiveness of the system.

Why This Is Needed:

  • Prevent Long-Running Queries: Large or complex queries can hang, blocking resources.
  • Maintain Responsiveness: Timeout ensures the application remains responsive under high load.
  • Better Error Handling: Gracefully handle long-running queries by returning a timeout error.

Requirements:

  • Use tokio::time::timeout to limit query execution time.
  • Ensure the Neo4J query is canceled if the timeout is exceeded.
  • Investigate Neo4J’s support for canceling timed-out queries. Per query timeout might be possible with apoc? . We can only use a global setting for timeout. That would make bigger queries difficult as well (e.g. reindexing will take long but we do not care so much).
CALL apoc.cypher.runTimeboxed("MATCH (n:Person{name:'Keanu Reeves'})-[*]-(other)
 RETURN count(*) as allPathsCount",
 {}, 20000)
@SHAcollision SHAcollision added enhancement New feature or request 🔮 nexus labels Oct 12, 2024
@SHAcollision SHAcollision changed the title Feat add timeout to some graph queries Feat: add timeout to graph queries Nov 18, 2024
@SHAcollision SHAcollision linked a pull request Nov 21, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 🔮 nexus
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants