Override `highWaterMark` didn't work
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- node.js, typescript
- 领域
- backend
调研方向
从 awslambda.streamifyResponse 入口点开始,跟踪其 highWaterMark 选项和 handler 符号的使用方式。重现这两个示例,并验证配置值为 512 时,早期写入会在延迟写入之前传送。
由索引模型根据 Issue 内容生成。
描述
The following code will send the data BEFORE 6s:
const util = require('node:util');
const HANDLER_HIGHWATERMARK = Symbol.for(
'aws.lambda.runtime.handler.streaming.highWaterMark',
);
const handler = async (event, responseStream, context) => {
responseStream.setContentType('text/html; charset=utf-8');
responseStream.write("Thinking...");
responseStream.write("a".repeat(64 * 1024));
setTimeout(function() {
responseStream.write("b".repeat(64 * 1024));
}, 3000);
setTimeout(function() {
responseStream.write("After 6s");
responseStream.end();
}, 6000);
};
handler[HANDLER_HIGHWATERMARK] = 512;
exports.handler = awslambda.streamifyResponse(handler, {
highWaterMark: 512
}
);
The following code will only send data AFTER 6s.
const util = require('node:util');
const HANDLER_HIGHWATERMARK = Symbol.for(
'aws.lambda.runtime.handler.streaming.highWaterMark',
);
const handler = async (event, responseStream, context) => {
responseStream.setContentType('text/html; charset=utf-8');
responseStream.write("Thinking...");
responseStream.write("a".repeat(1 * 1024));
setTimeout(function() {
responseStream.write("b".repeat(1 * 1024));
}, 3000);
setTimeout(function() {
responseStream.write("After 6s");
responseStream.end();
}, 6000);
};
handler[HANDLER_HIGHWATERMARK] = 512;
exports.handler = awslambda.streamifyResponse(handler, {
highWaterMark: 512
}
);
From what I tested, the default highWaterMark is 64Kb, but there is no way to override it to be lower, I tried two different ways to do it.
This causes weird issues where I can't send some tiny text and then wait 6s to send more data, it will be sent as a single chunk only after 6s.
This issue was initially discovered at https://github.com/H4ad/serverless-adapter/issues/166
- 主要语言
- TypeScript
- 星标
- 224
- 派生
- 60
- 平均合并
- 26 分钟
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
aws/aws-lambda-nodejs-runtime-interface-client 的其他 Issue
-
难度 5/5 一周以上 新手友好度 20/100
aws/aws-lambda-nodejs-runtime-interface-client#198 · 3 条评论 · 6 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 48/100
aws/aws-lambda-nodejs-runtime-interface-client#195 · 12 个 reaction ·
-
bug
aws/aws-lambda-nodejs-runtime-interface-client#170 · 15 条评论 · 6 个 reaction · 已指派 1 人 ·
-
难度 2/5 1-3 小时 新手友好度 38/100
aws/aws-lambda-nodejs-runtime-interface-client#159 · 2 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 42/100
aws/aws-lambda-nodejs-runtime-interface-client#145 · 1 条评论 · 6 个 reaction ·
查看 aws/aws-lambda-nodejs-runtime-interface-client 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
copse-dev/agent-pane#2953 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
难度 2/5 1-3 小时 新手友好度 78/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
-
calcite-components needs triage refactor
难度 2/5 1-3 小时 新手友好度 75/100
Esri/calcite-design-system#15203 ·