-
Notifications
You must be signed in to change notification settings - Fork 68
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
render complicated xml file #49
Comments
Hello, I don't think it is possible to abort a running function. Did you try the async function ? It will not shorten the time but it will free the main event loop and allow you to set your own timeout, something like this (not tested):
This is probably ok only if you don't care much about load as the task will still be running in the background and occupying a thread. Another, probably saner solution is to analyze summarily the xml input (string length ? number of nodes ?) before running libxslt. |
Hi Albanm, Thanks for your reply. The timeout solution looks good, but the task still be running is unacceptable. I'm not familiar with Thanks~ |
Actually I am not that familiar with it myself. I guess something like this would work to count the nodes:
But is it going to be efficient on a very large document ? I don't know. Maybe the document string length is a good enough estimate ? |
Does your conversion have to happen in a process that lives on, or could you create a process just for the conversion, and kill said process if the conversion takes too long? That would be the most robust way of doing this, I think. |
@mcgradycchen The issue you're having isn't specific to this library though. You'll want to learn how to setup new tasks/processes and control them to deal with that timeout scenario. Check out "Killing/Stopping the command" at http://krasimirtsonev.com/blog/article/Nodejs-managing-child-processes-starting-stopping-exec-spawn Basically, you'll want to make a module that has your task (which needs to be run, but needs to be cancelable also) and launch a new process which runs that task (and can be killed). |
Hi Albanm,
We got a issue. Sometimes our xml file is very complicated, the apply sync function will run more than 30 minutes and makes 100% cpu.
Is there a way to abort the apply function with a timeout parameter or how can I implement this request?
Thanks
The text was updated successfully, but these errors were encountered: