fix(filesystem): dedupe concurrent initial auth requests#1437
Open
cyfung1031 wants to merge 1 commit into
Open
fix(filesystem): dedupe concurrent initial auth requests#1437cyfung1031 wants to merge 1 commit into
cyfung1031 wants to merge 1 commit into
Conversation
Closed
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.
概要
修复首次授权场景下,并发调用
AuthVerify()时会重复触发授权流程的问题。当本地不存在 token 或 token 缺少
accessToken时,同一网盘类型的多个并发认证请求现在会复用同一个授权 Promise,避免重复打开授权页、重复请求 token、重复写入本地存储。主要改动
authTokenPromises,按网盘类型缓存首次授权中的 PromiseAuthVerify(netDiskType)在缺少 token 时复用同一次授权请求修复的问题
在多个同步任务或多个文件系统操作几乎同时触发认证时,如果当前没有可用 token,之前每个请求都会各自执行:
GetNetDiskToken这可能导致用户看到多个授权窗口,或者产生重复 token 请求。
本 PR 修复后,同一网盘类型的首次授权流程只会执行一次,其他并发请求等待同一个结果。
测试
新增单元测试覆盖: