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

Add Timeout For RPC Calls #68

Open
Rishi556 opened this issue Mar 9, 2024 · 2 comments
Open

Add Timeout For RPC Calls #68

Rishi556 opened this issue Mar 9, 2024 · 2 comments

Comments

@Rishi556
Copy link
Contributor

Rishi556 commented Mar 9, 2024

RPC calls that take longer than an arbitrary number of ms(defined in config) should be killed and the mongo query killed too with a request took too long error message

@klyed
Copy link

klyed commented Jun 6, 2024

I can add a TIMEOUT=x to the .env and use 'dotenv' module to pull it into the libraries and likely can achieve this..
(I think the newest version of NodeJS actually incorporates a way to import .env variables without 'dotenv' module?)

The architecture needs some refactoring in order to achieve this.. But I think it's possible to do in a short time frame.
Let me know if you'd like me to have a whack at this.. I've read most of the HE code base and have some idea of how this would be achieved.. I'm already a top 20 HE witness so achieving this would be a way to give back to a community that has voted me into a position where the node pays for itself.

As for the mongoDB edits I think with some work it's doable.. by default MongoDB will timeout a call to itself in 60 seconds if the query doesn't return a callback or data.. It may be possible to programmatically tie into the existing timeout in MongoDB and leverage that.

@klyed
Copy link

klyed commented Jun 6, 2024

FFound out how to do the mongoDB timeout... The syntax is as follows:

db.collection.find(
{ <query> },
{ <projection> }
).maxTimeMS( <milliseconds> )

I can start refactoring the codebase if you want.. as for the API timeout I'll have to look at the architecture and figure out the best method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants