luoshuijs

Results 22 comments of luoshuijs

If the above things are done, developers can better handle exceptions. ```python3 client = EnkaNetworkAPI(lang="en") try: # do something, like get uid async with client: data = await client.fetch_user(uid) except...

On Some Discussions **Timeout Handling** Regarding the `timeout` exception handling I previously raised, I'm quite puzzled when looking at the code below. I've also checked the official documentation of `aiohttp`...

If you use `httpx` and do not implement request retries, the refactored `HTTPClient.request()` method becomes more readable and maintainable. https://github.com/PaiGramTeam/PaiGram/blob/b4ef81dae69b6750f8eeb42ef424904f6710982d/utils/enkanetwork.py#L68-L112

@Billyzou0741326 刚刚看后台日记我都懵逼了,从2020-04-11 20:20:50开始出现了大量的错误 ```  [2020-04-11 22:22:53] Bilibili.getRoomsInArea - Http request errored - getaddrinfo ENOTFOUND api.live.bilibili.com  [2020-04-11 22:22:53] Bilibili.getRoomsInArea - Http request errored - getaddrinfo ENOTFOUND api.live.bilibili.com  [2020-04-11...

拿到日记了,我朋友那边在2020-04-10 14:38:01开始出现了大量的错误 ```  [2020-04-10 14:38:01] Bilibili.getRoomsInArea - Http request errored - getaddrinfo ENOTFOUND api.live.bilibili.com  [2020-04-10 14:38:02] Bilibili.getRoomsInArea - Http request timed out  [2020-04-10 14:38:03] Bilibili.getRoomsInArea - Http...

通过查看 https://billyzou0741326.github.io/bilibili-live-monitor-ts/#/faq/README 确认nofile上限已经设置最大,为65535

`top`查看发现只有一个监控在跑,通过`pm2 logs`命令对其监视,发现 ```PM2 | Stopping app:live id:0 PM2 | App [live:0] exited with code [0] via signal [SIGINT] PM2 | pid=17046 msg=process killed PM2 | App [live:0] starting in -fork...

看起来通过命令查看连接数,判断pm2模式运行下似乎是超出限制了,但是普通模式并没有出现这种情况,这很玄学了。 不知道是运行环境问题,而且我也发现这个机子似乎有点问题(?) 再次修改此issue已经再次确认``/etc/security/limits.conf``并没问题内容如下 ``` root soft nofile 65535 root hard nofile 65535 * soft nofile 65535 * hard nofile 65535 ```

刚刚注意到一个文件夹`/etc/security/limits.d`里面有个文件`20-nproc.conf` 刚刚通过网上查询到里面也有个限制 内容如下 ``` * soft nproc 4096 root soft nproc unlimited ``` 刚刚通过计算器计算得连接数正好接近4096,难道是这个配置文件的限制?但是问题是在top命令显示的时候已经以root权限运行,讲道理不应该出现这种情况。

刚刚修改了`/etc/security/limits.d/20-nproc.conf`文件,修改后如下 ``` * soft nproc 65535 root soft nproc unlimited ``` 然后重启系统后(如果重新链接SSH不会生效),再次执行正常运行了5分钟,使用`ss -t | awk ' $5 ~ /^[0-9]/ {print $5}' | cut -d: -f1 | sort | uniq -c...