当前位置:网站首页>Thirty two - nodejs simple proxy pool (is it finished?) The SuperAgent uses a timeout that is not a timeout

Thirty two - nodejs simple proxy pool (is it finished?) The SuperAgent uses a timeout that is not a timeout

2022-06-09 10:36:00 BerryBC

1. despair

When I thought Part 1 When it's over , After sneaking out for a McDonald's with my girlfriend during the closure of the city, I found , Still the same TCP Slow increase in number :
 Here should be a look of despair
Previous link :
Thirty one - NodeJS Simple proxy pool ( close ) And MongoDB The number of links exploded

2. screening

Go straight up The server See what's connecting so many TCP Connect , Don't see, don't know , It's a shock at first sight :

[[email protected] ~]$ netstat -tnlpoa|grep 9999|wc -l
399
[[email protected] ~]$ netstat -tnlpoa|grep 27017|wc -l
137

I'll go … Why? 9999 port than 27017 port So much TCP The number of connections
Take a closer look :

tcp        0      0 172.17.0.7:33426        163.204.244.111:9999    ESTABLISHED 2480/node /home/Ber  off (0.00/0/0)
tcp        0      1 172.17.0.7:48676        216.140.201.110:9999    SYN_SENT    2480/node /home/Ber  on (1.49/4/0)
tcp        0      1 172.17.0.7:47066        58.253.156.17:9999      SYN_SENT    2480/node /home/Ber  on (13.57/5/0)
tcp        0     78 172.17.0.7:44104        112.111.217.217:9999    ESTABLISHED 2480/node /home/Ber  on (65.50/15/0)
tcp        0      0 172.17.0.7:33446        182.35.85.137:9999      ESTABLISHED 2480/node /home/Ber  off (0.00/0/0)

ok , I admit I don't know what it means , So the search engine :
linux Next netstat --timers / -o Explain and keepalive relevant
I collapsed. , There are some Connect For a whole 5、6 Even minutes .
But my code clearly states Timeout It's about ten seconds !

3. Code

        let funGoRandSpy = (strRandProxy, funCB) => {
    
            //  On the Internet, I see that many high-profile agents are 9999 Port of , Just try a random test of everything on the Internet 9999 Ports 
            //  Check the port instructions  sudo netstat -tnlpoa|grep 9999|wc -l
            let strProxy = 'http://' + strRandProxy + ':9999';
            // console.log(' testing :' + strProxy);
            //  among  intTimeout  by  3000 ms
            request.get('https://www.baidu.com').timeout({
     response: that.intTimeout, deadline: that.intTimeout * 3 }).use(superagentCheerio).proxy(strProxy).set(that.objHeader).then((res) => {
    
                let objProxyForSave = {
     u: strRandProxy, p: '9999' };
                objCTLSave.saveOneProxy(objProxyForSave, () => {
    });
                console.log(' ' + strProxy + '  The test passed unexpectedly !');
                funCB(null, true);
            }).catch((err) => {
    
                funCB(null, true);
            });
        };

Why have you given feedback Overtime , You've been waiting !? My heart is waiting , Always waiting for ?
I searched the Internet for a long time , I also found SuperAgent Official website , I didn't say why , Then why !?

4. Temporary settlement

Temporary Solution yes , Since it Connect The biggest is 10 Minutes of , I decided to put this Perpetual cycle Put it in 10 Minutes later , That should be OK ?
See the results tomorrow after you wake up .

I think it can be solved .

5. Does anyone know why !!

Is there any A great god Please tell me how to break it ?
I feel , Need from The server From above ( My is Centos 7). SuperAgent Official website There is no similar answer in , I'm desperate .
Okay , Go to work tomorrow , Good night, .

原网站

版权声明
本文为[BerryBC]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206090959013291.html