-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
Timeout option on refParser.validate()
#134
Comments
I think this is best handled by the callers of the library - we have |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey,
Thanks so much for your excellent work on this module and swagger-parser, we're extensive users of both @ ReadMe. We occasionally accept very large files from our customers which can take a prohibitively long time to validate(), which blocks the event loop and affects performance for other requests.
We've gotten around this by performing the validation in a forked child process, and adding a setTimeout() in the parent process. If the setTimeout gets hit before the child process can validate and dereference, then we return an error and kill the child.
This has worked surprisingly well for us, but has added some complexity to our code. Would it be possible to add a timeout anywhere inside this module? Maybe by utilising process.nextTick so the validation doesn't block the event loop? I've not looked into the code of this module before, so I may be wildly off the mark here, but if I can help out in any way then I'd love to!
Looking forward to hearing your thoughts.
Dom
The text was updated successfully, but these errors were encountered: