There is a problem. If node-zone include node-zone, the outside will be replaced by the last child zone data.
未关闭
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- backend
调研方向
从 issue 中的复现开始,检查 current、fork 和 run 的 node-zone 实现。复现嵌套的异步调用,然后追踪为什么外层 zone 会被最后一个子 zone 替换;完成的标准是子 zone 结束后,外层 current 仍然保留其原始数据。
由索引模型根据 Issue 内容生成。
描述
const {current} = require('node-zone');
let zone = current.fork('my zone');
zone.data = {test: 'test'};
zone.run(async () => {
let __current = require('node-zone').current;
console.log(__current);
for (let i = 0; i < 50; i++) {
(async function (i) {
let zone = current.fork('my zone ' + i);
zone.data = {i: i};
// zone.run()
// zone.set('i', 123456);
// console.log(current);
zone.run(async () => {
(async function () {
(async function () {
(async function () {
let {current} = require('node-zone');
// console.log(common.timeHelper.format_ms(), current);
console.log(current);
})();
})();
})();
});
})(i);
}
//will lost the current, will show the last child zone data.
console.log('current zone data', __current);
console.log('last child zone data', require('node-zone'));
});
return;
- 主要语言
- JavaScript
- 星标
- 2
- 派生
- 1
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 75/100
docToolchain/docToolchain#1705 ·
-
Timezone select lists one option per character; duplicate "Failed" reason; shared tracker popover id 未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
nightscout/nocturne#1414 ·
-
bug v2
难度 2/5 1-3 小时 新手友好度 75/100
modelcontextprotocol/inspector#2458 · 1 条评论 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
难度 2/5 1-3 小时 新手友好度 70/100
carbon-design-system/ibm-products#9907 ·