feat(infra-fe): 新增异步编程学习资料与工具实现 - #8
Open
sqliang wants to merge 1 commit into
Open
Conversation
- custom-promise: 手写 Promise 实现,覆盖状态机与链式调用 - poll-task: 轮询任务工具,支持同步/异步任务与条件终止 - run-task-pool: 任务池并发控制,组合重试策略 - task-with-retry: 异步任务重试封装 - task-with-timeout: 基于 Promise.race 的任务超时控制
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
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.
Summary
在 infra-fe 包中新增一组异步编程学习资料与工具实现,覆盖 Promise 原理、轮询、并发控制、重试与超时等常见异步场景。
Changes
custom-promise.ts: 手写 Promise 实现,覆盖状态机、thenable 解析与链式调用poll-task.ts: 轮询任务工具,支持同步/异步任务、条件终止与 AbortSignal 取消run-task-pool.ts: 任务池并发控制,可与重试策略组合task-with-retry.ts: 异步任务重试封装,支持取消与剩余次数上下文task-with-timeout.ts: 基于 Promise.race 的任务超时控制Verification
pnpm -C packages/infra-fe exec eslint src/async-task/0 errorspnpm -C packages/infra-fe type-check通过pnpm build:infra-fe构建成功