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: 使用内置的 AbortSignal.timeout 代替自编写的 fetchWithTimeout #176

Merged
merged 1 commit into from Apr 11, 2023
Merged

Conversation

LinLin00000000
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Apr 9, 2023

@LinLin00000000 is attempting to deploy a commit to the busiyi Team on Vercel.

A member of the Team first needs to authorize it.

@netlify
Copy link

netlify bot commented Apr 9, 2023

Deploy Preview for sunny-custard-1d01af ready!

Name Link
🔨 Latest commit d9089cb
🔍 Latest deploy log https://app.netlify.com/sites/sunny-custard-1d01af/deploys/64324c116461af0008bda4a2
😎 Deploy Preview https://deploy-preview-176--sunny-custard-1d01af.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ourongxing ourongxing merged commit cda0250 into ourongxing:main Apr 11, 2023
5 of 6 checks passed
@xingstarx
Copy link

感觉用这个,效果不太好啊,我有一个站点,超时的特别严重,调用api,成功一次,就能失败很多次。
上图:
image

大佬们要不仔细确认下这种新的超时判断是否需要优化下呢😂

@LinLin00000000
Copy link
Contributor Author

感觉用这个,效果不太好啊,我有一个站点,超时的特别严重,调用api,成功一次,就能失败很多次。 上图: image

大佬们要不仔细确认下这种新的超时判断是否需要优化下呢😂

有没有可能是因为免费的apikey导致被 openai 限速了呢?一般设置超时时间 30 秒(也是默认设置)就不会超时了

@LinLin00000000
Copy link
Contributor Author

感觉用这个,效果不太好啊,我有一个站点,超时的特别严重,调用api,成功一次,就能失败很多次。 上图: image

大佬们要不仔细确认下这种新的超时判断是否需要优化下呢😂

抱歉,AbortSignal.timeout 的实现确实和原有实现不一致。
原有实现的 setTimeout 应该仅限于接收到响应,而不考虑内容下载的时间(也就是 chatgpt 打字的时间),但是 AbortSignal.timeout 的超时时间还考虑了这个,所以一旦让 chatgpt 回复长一点的内容就会超时。
我仔细研究了 whatwg/dom#951 w3ctag/design-reviews#711 whatwg/dom#1032 nodejs/node#40899 https://dom.spec.whatwg.org/#interface-AbortSignal, 暂时还没有发现取消 timer 的方法,一个可能的提案是 https://github.com/whatwg/dom/issues/1039。
现在只能请求作者回滚了 @ourongxing

@xingstarx
Copy link

xingstarx commented Apr 12, 2023

嗯,对的呢,因为我有两个站点,我仔细比对过差异,感谢大佬们的快速响应呀,谢啦

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.

None yet

3 participants