Closed Siykt closed 1 year ago
卧槽, 这啥啊, 这样不是只要 result.code === 800
就会递归调用 getQrCodeKey
里的 setInterval
一直发请求 ??!!:
src/views/loginAccount.vue:232
getQrCodeKey() { return loginQrCodeKey().then(result => { if (result.code === 200) { // ... } this.checkQrCodeLogin(); }); }, checkQrCodeLogin() { this.qrCodeCheckInterval = setInterval(() => { if (this.qrCodeKey === '') return; loginQrCodeCheck(this.qrCodeKey).then(result => { if (result.code === 800) { this.getQrCodeKey(); // 重新生成QrCode this.qrCodeInformation = '二维码已失效,请重新扫码'; } //... }); }, 1000); },
解决方案
// 这里需要clearInterval
this.qrCodeCheckInterval = setInterval(() => {
这是云函数执行时间的可用余额用完了,根据我的测试,如果开启一个登录页面24小时,所耗流量不到400MB。
这是云函数执行时间的可用余额用完了,根据我的测试,如果开启一个登录页面24小时,所耗流量不到400MB。
目前我调用它这个的地方也就只有这个music项目, 它这种循环的方式是线性提升的, loginQrCodeCheck
只要不符合预期它就会创建一个每秒轮询的定时器, 所以下一次就是每秒 2 次的请求, 接着就是 4 8 16 32... 而且就算返回正常的结果, 之前的定时器也不会被清除
[Bug] /login/qr/check 接口流量消耗异常, 一下午300个G
系统/平台: vercel
nodejs 版本: 16
API版本: 4.8.11
出现问题
就今天发生的, 听了一下午歌流量没了, 干了300个G
重现步骤
我vercel已经挂了有点诡异, 歌的话是 Roads
https://github.com/Binaryify/NeteaseCloudMusicApi/issues/1769