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

插件仓库下载列表未准确识别 #239

Closed
AnzhiZhang opened this issue Jan 30, 2023 · 9 comments
Closed

插件仓库下载列表未准确识别 #239

AnzhiZhang opened this issue Jan 30, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@AnzhiZhang AnzhiZhang added the bug Something isn't working label Jan 30, 2023
@Ra1ny-Yuki
Copy link
Contributor

这是生成该说明文档commit的action(Scheduled update #14168),于Fetch data阶段获取start_stop_helper_r release后可见报错:not 200 status code when fetching repository file readme-zh_cn.md: 404

https://github.com/MCDReforged/PluginCatalogue/actions/runs/3922973249/jobs/6706276907

@AnzhiZhang
Copy link
Member Author

AnzhiZhang commented Jan 31, 2023

这是生成该说明文档commit的action(Scheduled update #14168),于Fetch data阶段获取start_stop_helper_r release后可见报错:not 200 status code when fetching repository file readme-zh_cn.md: 404

https://github.com/MCDReforged/PluginCatalogue/actions/runs/3922973249/jobs/6706276907

这个问题看起来不是这个插件的,这个插件没有写 readme-zh_cn.md

@AnzhiZhang
Copy link
Member Author

找到原因了,请求 API 并没有做翻页,导致没有获取到较老的 release

plugin.py

url = f'https://api.github.com/repos/{plugin.repos_path}/releases'
resp: Optional[List[dict]]
new_etag: str
resp, new_etag = utils.request_github_api(url, etag=self.etag)

utils.py

response = requests.get(url, proxies=constants.PROXIES, headers=headers)

@AnzhiZhang
Copy link
Member Author

根据文档,只返回了30个release……
https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#list-releases

@AnzhiZhang AnzhiZhang pinned this issue Feb 3, 2023
@alex3236
Copy link
Contributor

alex3236 commented Feb 4, 2023

根据文档,只返回了30个release…… https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#list-releases

似乎没有给总页数?

@AnzhiZhang
Copy link
Member Author

可以翻到为空的最后一页就行了,或者查看有内容的最后一页是不是达到最大数量

alex3236 added a commit that referenced this issue Feb 21, 2023
@alex3236
Copy link
Contributor

master...multi-page-releases-support
简单地修了一下
但对于类似 @AnzhiZhang 那种单 repo 多插件,每个插件检查时都会重新获取 Releases 的每一页,有点浪费 API 使用次数

@AnzhiZhang
Copy link
Member Author

AnzhiZhang commented Feb 21, 2023

但对于类似 @AnzhiZhang 那种单 repo 多插件,每个插件检查时都会重新获取 Releases 的每一页,有点浪费 API 使用次数

无论多repo还是单repo,总共需要获取的release总数是不变的,反而单repo会节省使用次数,因为不到一页的插件被合并了
前提是做好release获取的缓存,不要到一个插件读一次所有release

@alex3236
Copy link
Contributor

但对于类似 @AnzhiZhang 那种单 repo 多插件,每个插件检查时都会重新获取 Releases 的每一页,有点浪费 API 使用次数

无论多repo还是单repo,总共需要获取的release总数是不变的,反而单repo会节省使用次数,因为不到一页的插件被合并了 前提是做好release获取的缓存,不要到一个插件读一次所有release

对的 理论上做好缓存可以节省API使用次数 但反正我这个分支暂时没做(

@Fallen-Breath Fallen-Breath unpinned this issue Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants