phantombuster / nickjs

Web scraping library made by the Phantombuster team. Modern, simple & works on all websites. (Deprecated)
https://nickjs.org
ISC License
500 stars 48 forks source link

Is there any way to exit the program except for nick.exit()? #36

Closed msaus closed 6 years ago

msaus commented 6 years ago

I am making web based api with express4 and pm2.

When I call nick.exit(), my api auto-restarts because it is calling exit() function.

So, is there any way that I can finish using nickjs? like not auto-restarting the api?

paps commented 6 years ago

Take a look at issue #26 (basically nick.exit() calls process.exit())

What you can do is close your tabs with tab.close(). NickJS doesn't come with the ability to stop Chrome unfortunately. It's just automatically killed on exit.

msaus commented 6 years ago

Thanks for that. I will try it out (^_^)ノ

msaus commented 6 years ago

I tried tab.close(). Then, I found that there are around 5 to 12 Google chrome processes being kept. I do not care of it being kept, but, I felt the number of process is quiet high after nickjs execution. Is this normal after execution?

paps commented 6 years ago

Yes, I think it is normal. Chrome has at least one process per tab and other processes spreading the load for different tasks. I do not know how it's implemented, but very smart Google engineers must have decided that keeping processes speeds up the whole thing in normal browsing situations.

You can see it for yourself when using Chrome as a human. Open 10 tabs then close them, you'll see a lot of processes left running in your system.

paps commented 6 years ago

To be clear though, if you still have Chrome processes after having called nick.exit(), this NOT normal.