bilive / bilive_client

基于Node.JS的bilibili账号活跃系统
MIT License
457 stars 109 forks source link

在使用中移除不可用ip #48

Closed Fireblossom closed 6 years ago

Fireblossom commented 6 years ago

近期我这里遇到了相当多如下错误: Jan 09 2018 18:20:07 : { Error: connect ETIMEDOUT 27.221.106.4:80 at Object._errnoException (util.js:1031:13) at _exceptionWithHostPort (util.js:1052:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1195:14) errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', address: '27.221.106.4', port: 80 } 我推测是因为我的机器网络状况不好(不在大陆),貌似该ip仍然通过了tool里面的1000毫秒那个测试但是有比较严重的丢包。然后我尝试了两种方案:

然后……然后我瞎改完了请大佬过目。

lzghzr commented 6 years ago

嗯,看了一下日志,不可用ip为三个,因为每天00:30会再次测试,这三个ip已经被剔除掉了 所以测试应该是没什么问题,只是因为24小时更新一次有点慢

Fireblossom commented 6 years ago

`Jan 09 2018 17:19:58 : dx 获取抽奖结果 34822 { Error: connect ETIMEDOUT 58.56.111.209:80 at Object._errnoException (util.js:1031:13) at _exceptionWithHostPort (util.js:1052:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1195:14) errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', address: '58.56.111.209', port: 80 }

Jan 09 2018 17:20:30 : { Error: connect ETIMEDOUT 223.99.231.4:80 at Object._errnoException (util.js:1031:13) at _exceptionWithHostPort (util.js:1052:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1195:14) errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', address: '223.99.231.4', port: 80 }

Jan 09 2018 17:29:25 : { Error: connect ETIMEDOUT 27.221.106.4:80 at Object._errnoException (util.js:1031:13) at _exceptionWithHostPort (util.js:1052:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1195:14) errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', address: '27.221.106.4', port: 80 }

Jan 09 2018 18:09:46 : { Error: connect ETIMEDOUT 58.56.111.209:80 at Object._errnoException (util.js:1031:13) at _exceptionWithHostPort (util.js:1052:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1195:14) errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', address: '58.56.111.209', port: 80 }

Jan 09 2018 18:10:51 : { Error: connect ETIMEDOUT 223.99.231.4:80 at Object._errnoException (util.js:1031:13) at _exceptionWithHostPort (util.js:1052:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1195:14) errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', address: '223.99.231.4', port: 80 }

Jan 09 2018 18:16:27 : 127.0.0.1:55502 已连接

Jan 09 2018 18:17:56 : 127.0.0.1:55502 已断开 1000

Jan 09 2018 18:20:07 : { Error: connect ETIMEDOUT 27.221.106.4:80 at Object._errnoException (util.js:1031:13) at _exceptionWithHostPort (util.js:1052:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1195:14) errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', address: '27.221.106.4', port: 80 }

^Cnpm ERR! code ELIFECYCLE npm ERR! errno 3221225786 npm ERR! bilive_client@1.3.1 start: node app.js npm ERR! Exit status 3221225786 npm ERR! npm ERR! Failed at the bilive_client@1.3.1 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2018-01-09T10_58_35_497Z-debug.log

^CTerminate batch job (Y/N)? y`

今天又看了看我昨天下午的log 应该是因为首先加入小电视抽奖的那个ip就出错了。而且后面这些ip不可能都是不可用的,然后每隔大约30秒输出了一次_RaffleReward()里的那个错误,可是这些为啥都是 errno: 'ETIMEDOUT',不懂…… 所以是不是可以让参加失败的抽奖不再执行_RaffleReward()

lzghzr commented 6 years ago

https://github.com/lzghzr/bilive_client/blob/b244bf48419e4d4279e23ee39a9e645692d9beab/bilive/raffle.ts#L96-L100 抽奖失败就不会进入_RaffleReward() 以及'ETIMEDOUT'是超时错误

Fireblossom commented 6 years ago

这么多ip全超时了啊qaq,那还是要经常登陆看看时常重启才好。 多谢大佬解惑。

lzghzr commented 6 years ago

嗯,感谢提供的思路,下个版本会加上出错自动剔除ip的