07th-mod / 07th-mod/python-patcher

If POST takes longer than 8 seconds, installer immediately gives up rather than continuing to wait

未关闭
#146 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
JavaScript
星标
214
派生
12
PR 合并指标
30 天内没有已合并 PR

描述

We had an issue where a user had an infinite loading screen on the part of the installer which autodetects game paths.

There were no relevant errors on the install log, but the browser showed a POST error, as if the python side never responded.

What actually happened was that the python side had no errors, but it took longer than 8 seconds to respond. Because the HTML side gives up after 8 seconds, the HTML side raised an error, but the Python side did not. This was because I implemented the timeout using the native `XMLHttpRequest` timeout functionality, which cancels the POST after a timeout (...or at least I think that's how it works).

The installer should really show an error after 8 seconds (or however many seconds), but continue to listen for the response.

The error message should also be adjusted to tell the user to wait some time in case the operation just takes a long time.

I actually had hard-coded that if the request type was `showFileChooser`, there was no POST timeout, but I feel hard-coding specific requests to not the right way to do this.

A related issue is *why* the game scanning step took so long - the user was using a SSD, and didn't have that many games installed on their computer. It could be:
- my installer is doing something really bad and taking ages
- your computer is slow for some reason
- there is a game which causes the installer's scanning algorithm to give worst-case behavior

The scanning should really give up if it took more than a certain amount of time to scan, as even if scanning fails, the installer can still be used. Or perhaps have a per-directory scan timeout.

The installer also doesn't print how long/which folders were scanned,

----

- [ ] Fix POST timeout behavior
- [ ] Investigate slow game scanning
- [x] Set a timeout on game scanning (make sure to only enable this when scanning many paths, not when checking a user-specified path) 4efd0b9f3ef1691ff3c4ac8ec281c343587184da
- [x] Add button to cancel scanning (currently becomes greyed out forever if scanning never finishes) e6371a58aa81bcc1fcbe6ad2bf75cd215feaac26

贡献指南

这个仓库没有索引到贡献指南

调研方向

查看安装程序前端代码中 XMLHttpRequest 的超时处理,可能在管理 POST 请求的 JavaScript 文件中。后端扫描逻辑在 Python 中;检查游戏路径检测函数。该议题提到了扫描超时和取消按钮的提交;审查这些更改以了解当前状态。确定如何修改超时设置以不取消请求,并相应调整错误消息。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, python
领域
cli, desktop, tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。