Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Deno #48

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft

refactor: Deno #48

wants to merge 38 commits into from

Conversation

YDX-2147483647
Copy link
Owner

@YDX-2147483647 YDX-2147483647 commented Nov 6, 2023

原因:开发、部署更简单,速度更快。

(To be squashed and merged)

@YDX-2147483647
Copy link
Owner Author

现在功能基本正常,只是超时的错误还未捕获。

deno run -A ./src/examples/proxy-cli.ts
{"level":"info","message":"Signed in successfully.","plugin":"proxy","timestamp":"2023-11-07T05:57:44.397Z"}
{"level":"info","message":"发现48个通知来源。","plugin":"cli","timestamp":"2023-11-07T05:57:47.580Z"}
{"level":"http","message":"Request https://century.bit.edu.cn/tz/index.htm with proxy.","plugin":"proxy","timestamp":"2023-11-07T05:57:47.584Z"}
{"level":"http","message":"Request https://student.bit.edu.cn/tzgg/index.htm with proxy.","plugin":"proxy","timestamp":"2023-11-07T05:57:47.585Z"}
{"level":"http","message":"Request https://student.bit.edu.cn/xngs/index.blk.htm with proxy.","plugin":"proxy","timestamp":"2023-11-07T05:57:47.585Z"}
{"level":"http","message":"Request http://cxcy.bit.edu.cn/pt/pt/Notice with proxy.","plugin":"proxy","timestamp":"2023-11-07T05:57:47.586Z"}
{"level":"http","message":"Request http://dekt.bit.edu.cn/portal/CourseList.jsp with proxy.","plugin":"proxy","timestamp":"2023-11-07T05:57:47.586Z"}
{"level":"http","message":"Request https://dzb.bit.edu.cn/cms/web/notify/search?page=1&status=7&rows=20&order=1&sortFiled=publishDate with proxy.","plugin":"proxy","timestamp":"2023-11-07T05:57:47.588Z"}
{"level":"http","message":"Request http://mec.bit.edu.cn/pcmd/ajax.php?vpn-12-o1-mec.bit.edu.cn&act=getmanage_nologin&w=新闻公告 with proxy.","plugin":"proxy","timestamp":"2023-11-07T05:57:47.589Z"}
{"level":"warn","message":"未从“第二课堂”获取到任何通知。将忽略。","plugin":"cli","timestamp":"2023-11-07T05:57:47.667Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://ls.bit.edu.cn/xytz/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.200Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://sae.bit.edu.cn/tzgggb/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.201Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://rw.bit.edu.cn/rwszjyb/tzxw/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.201Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://rw.bit.edu.cn/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.201Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://smt.bit.edu.cn/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.201Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://jxzx.bit.edu.cn/jxyx/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.202Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://marx.bit.edu.cn/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.204Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://xxgk.bit.edu.cn/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.204Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://cs.bit.edu.cn/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.204Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://abroad.bit.edu.cn/xwtz/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.204Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://sme.bit.edu.cn/gbxwzx/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.204Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://cst.bit.edu.cn/xxfw/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.205Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://smen.bit.edu.cn/tzgg1/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.205Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://renshichu.bit.edu.cn/gbtzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.205Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://hi.bit.edu.cn/rxbd/dttzyx/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.205Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://physics.bit.edu.cn/tzgg4/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.205Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://design.bit.edu.cn/zs/tz2/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.205Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://me.bit.edu.cn/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.205Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://xyy.bit.edu.cn/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.205Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://xxgk.bit.edu.cn/zxgkxx/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.205Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://xuteli.bit.edu.cn/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.206Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://sie.bit.edu.cn/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.206Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://jxzx.bit.edu.cn/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.206Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://grd.bit.edu.cn/tzgg1/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.206Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://itc.bit.edu.cn/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.206Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://opt.bit.edu.cn/tzgg2/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.206Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://jwb.bit.edu.cn/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.206Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://isc.bit.edu.cn/eventsnotices/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.206Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://math.bit.edu.cn/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.207Z"}
{"hook":"fetch_each.error","level":"error","message":"TypeError: error sending request for url (https://mingde.bit.edu.cn/tzgg/index.htm): error trying to connect: tcp connect error: Connection timed out (os error 110)","plugin":"cli","timestamp":"2023-11-07T05:59:58.207Z"}
{"level":"warn","message":"未找到以往通知,您可能是第一次运行。将忽略。","timestamp":"2023-11-07T05:59:58.216Z"}
{"level":"info","message":"已按需保存到“output/notices.json”。","plugin":"cli","timestamp":"2023-11-07T05:59:58.219Z"}

@YDX-2147483647
Copy link
Owner Author

YDX-2147483647 commented Nov 10, 2023

deno 的 Fetch API 似乎和浏览器一样,没有超时一说,可能卡住。


更新:从2023年11月8–23日在校内测试服务器上要求每日运行一次,只有10日、15日异常,都是超时。

2023年12月12日更新:上次至今,11月24–12月1日、12月3日、12月5–11日都卡住了,其余都成功更新。从2023年12月12日起,改用 #53,让我们拭目以待。

2023年12月21日更新:12月12–17、20–21日正常,18、19日卡住。此后修改了 crontab 脚本,超过 10 min 强制结束。

2023年12月29日更新:12月23、26–28日正常,22、24、25日超时。


2023年12月28日在另一校外 Windows 服务器上每日运行一次,不另设时间上限。

2023年12月28–29日正常。

The log records the following errors.

```shell
jq 'select(.level == "error" and (.message | contains("Timeout") | not))' output/combined.log | bat -l json
```

```
HTTPError: Request failed with status code 400 Bad Request
SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant