Conversation
getMatcherJson 遇到值中 = 后有 & 会跳过解析,导致 readRuleValue 将 http:// 开头的 matcher 当作 URL 发起请求,超时约 16s。 在 readRuleValue 之前增加 tryParseMatcher fallback 即可避免。
Author
我这个写法看着就很怪。其实这种复杂的替换,我应该一开始就用正则才对的。 |
Owner
|
你配置的规则存在一点问题。 # 本地文件
resReplace:///Usr/xxx/xxx
# 远程 URL
resReplace://http(s)://xxx
# Values / 内嵌值
resReplace://{xxx.json}
# 内联值(需用小括号括起来)
resReplace://(xxxx&xxxx或不含空格的JSON字符串)
# 包含 = 但不是 url 及 本地文件
resReplace://k1=v1&k2=v2而你实际配置的是: gamemaker.weixin.qq.com resReplace://http://gamemaker.weixin.qq.com=https://gamemaker.weixin.qq.com&http://{{uuid}}.gamemaker.weixin.qq.com=https://{{uuid}}.gamemaker.weixin.qq.comWhistle 会将 gamemaker.weixin.qq.com resReplace://(http://gamemaker.weixin.qq.com=https://gamemaker.weixin.qq.com&http://{{uuid}}.gamemaker.weixin.qq.com=https://{{uuid}}.gamemaker.weixin.qq.com)为避免此类问题,务必使用小括号将其包裹为内联值。我看下能不能避免这类情况。 |
Author
这些因素纠缠在一起,所以我个人感觉还是不要merge这个pr了吧。就当我是反馈一下问题。 |
Author
|
我个人看来,最简单的方式是,whistle在这种value隔离不明确的场景,可以尝试检测一下特殊字符,然后无论通不通(静态检测,无法确定),都提示用户,这种用法可能导致进入不可知的场景。引导用户采用正则这样更确定性的路径。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
---- 人话 ----
我这段时间在做一个基于vscode web版本的项目,dev模式下,每次都要加载7000+个文件。对应的 whistle 规则里面,我用了
这样一句。一开始也没觉得有什么不对。直到今早上,帮别人排查一个sse的问题(其实在这个bug场景中,sse是个干扰项),结果对应的response总是迟到20+s才返回,我就拉着后台和运维同事和测试组的同事折腾了一早上。结果他们发现,用shell的curl来重现问题,就无法重现,只有我的浏览器有问题。
我百思不得其解,不甘心查了一下午,发现原来是whistle的这个 resReplace 的解析方式有问题。
---- ai commit message ----
getMatcherJson 遇到值中 = 后有 & 会跳过解析,导致 readRuleValue
将 http:// 开头的 matcher 当作 URL 发起请求,超时约 16s。
在 readRuleValue 之前增加 tryParseMatcher fallback 即可避免。
---- ai pr message ----
这是我跟cursor用debug mode查了一下午,总结历史而成的pr message。我自测这个fix是没问题的,但是否修在了精准的地方,还得您来判断。