-
Notifications
You must be signed in to change notification settings - Fork 17
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
How to run with nightmarejs ? #25
Comments
same problem here |
@GautierT use xvfb package instead, look at this comment: segment-boneyard/nightmare#602 (comment) |
@mateuszmazurek : Thanks ! Just got it working this morning with xvfb ! |
@GautierT currently I have one Xvfb process started by |
Okay thanks ! |
How many instances you need to run to make it crash? 2 or more? Did you try to use |
When i launch the script 4 or 5 times some of then will crash (Last line of nightmare log : |
Hmm... Maybe you have no enough RAM? Why do you need to run this script multiple times in parallel? |
Because it's a script launch by user when the visit a url of my website. And multiple user can access this url at the same time. |
Can't you just launch this script once and there create http server (maybe with |
That's what i do ! I have an expressjs server running. And when someone go to /api/scripts/script_name a function creating a new Xvfb() and a new Nightmare() is launched. But if i go to this url 5 times at the same time some of the script will never finish (timeout or crash) in no particular order. 4 times : sometimes all script finish well sometimes not ! Thanks for trying man ! I'm feeling less alone ! |
Try to run you whole process inside Xvfb using Example: // at the top of your script
const Queue = require('promise-queue');
const queue = new Queue(1, Infinity); // change 1 with the number of concurrent requests you want to handle
...
// inside express request callback
queue.add(() => {
const nightmare = new Nightmare({
//show: true,
webPreferences: {
partition: 'nopersist'
}
});
console.log('nightmare started')
return
nightmare.goto('http://www.google.fr')
// ..... other instruction....
.then(() => {
// do sth
});
}); |
I will try that ! Thanks ! |
It's not better, I'm proposing to test it just to be 100% sure that it's not problem with node-xvfb. |
Thanks a lot @mateuszmazurek. The queue work very well... I run it with 1 concurrency and i used node-xvfb and the cpu goes between 40 and 60%. And the script goes pretty fast ! |
Hi,
how to use it with nightmarejs ?
Should i do :
Nightmare seems to start but nothing happen after...
Thanks !
The text was updated successfully, but these errors were encountered: