T
T
theyuri2018-11-15 14:55:18
Node.js
theyuri, 2018-11-15 14:55:18

How to organize multithreading?

Hello. I had a task: there is a site on which links appear randomly in time, the point is that you need to click on them. For everything to work, you need to be logged in, i.e. with cookies. It was first an application with one thread - in the browser window. It kept refreshing the page, but that wasn't enough. In the new application, I made several threads - which log in through a proxy and then also refresh the page in search of links. I organized it this way - through the admin panel, the user sets how many threads will work. Then, on the server with the node, they - the threads start to run through promises (i.e. one started - called a callback - the other starts to start). As soon as they all start, each recursively starts calling its work method (which refreshes the page, looks for links, follows them if there are free ones, and updates again). The question is - did I organize multithreading correctly or could it be done differently? And maybe there are some suggestions for improving the architecture? For even in 4 streams through proxies (free, spars from other sites), she does not have time to click on links, other users with their programs are faster.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question