Fix: only create the buffer once in responseInterceptor, fixes #929#1235
Fix: only create the buffer once in responseInterceptor, fixes #929#1235fozcode wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughresponseInterceptor now buffers decompressed proxy response chunks in a ChangesBuffer chunking optimization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.gitignore:
- Around line 89-91: Revert the temporary .gitignore changes that expose the
dist directory: remove the added comment block and the uncommented/dist entry
from the PR so the upstream .gitignore does not track dist; instead keep any
dist-related ignore changes only in your fork or a dedicated branch (do not
commit the "dist" line or the temporary comment into the shared .gitignore).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 475e2553-5740-43ec-a5d6-529457392192
⛔ Files ignored due to path filters (62)
dist/configuration.d.tsis excluded by!**/dist/**dist/configuration.jsis excluded by!**/dist/**dist/debug.d.tsis excluded by!**/dist/**dist/debug.jsis excluded by!**/dist/**dist/errors.d.tsis excluded by!**/dist/**dist/errors.jsis excluded by!**/dist/**dist/factory-hono.d.tsis excluded by!**/dist/**dist/factory-hono.jsis excluded by!**/dist/**dist/factory.d.tsis excluded by!**/dist/**dist/factory.jsis excluded by!**/dist/**dist/get-plugins.d.tsis excluded by!**/dist/**dist/get-plugins.jsis excluded by!**/dist/**dist/handlers/fix-request-body.d.tsis excluded by!**/dist/**dist/handlers/fix-request-body.jsis excluded by!**/dist/**dist/handlers/index.d.tsis excluded by!**/dist/**dist/handlers/index.jsis excluded by!**/dist/**dist/handlers/public.d.tsis excluded by!**/dist/**dist/handlers/public.jsis excluded by!**/dist/**dist/handlers/response-interceptor.d.tsis excluded by!**/dist/**dist/handlers/response-interceptor.jsis excluded by!**/dist/**dist/http-proxy-middleware.d.tsis excluded by!**/dist/**dist/http-proxy-middleware.jsis excluded by!**/dist/**dist/index-hono.d.tsis excluded by!**/dist/**dist/index-hono.jsis excluded by!**/dist/**dist/index.d.tsis excluded by!**/dist/**dist/index.jsis excluded by!**/dist/**dist/logger.d.tsis excluded by!**/dist/**dist/logger.jsis excluded by!**/dist/**dist/path-filter.d.tsis excluded by!**/dist/**dist/path-filter.jsis excluded by!**/dist/**dist/path-rewriter.d.tsis excluded by!**/dist/**dist/path-rewriter.jsis excluded by!**/dist/**dist/plugins/default/debug-proxy-errors-plugin.d.tsis excluded by!**/dist/**dist/plugins/default/debug-proxy-errors-plugin.jsis excluded by!**/dist/**dist/plugins/default/error-response-plugin.d.tsis excluded by!**/dist/**dist/plugins/default/error-response-plugin.jsis excluded by!**/dist/**dist/plugins/default/index.d.tsis excluded by!**/dist/**dist/plugins/default/index.jsis excluded by!**/dist/**dist/plugins/default/logger-plugin.d.tsis excluded by!**/dist/**dist/plugins/default/logger-plugin.jsis excluded by!**/dist/**dist/plugins/default/proxy-events.d.tsis excluded by!**/dist/**dist/plugins/default/proxy-events.jsis excluded by!**/dist/**dist/plugins/define-plugin.d.tsis excluded by!**/dist/**dist/plugins/define-plugin.jsis excluded by!**/dist/**dist/plugins/index.d.tsis excluded by!**/dist/**dist/plugins/index.jsis excluded by!**/dist/**dist/router.d.tsis excluded by!**/dist/**dist/router.jsis excluded by!**/dist/**dist/status-code.d.tsis excluded by!**/dist/**dist/status-code.jsis excluded by!**/dist/**dist/types.d.tsis excluded by!**/dist/**dist/types.jsis excluded by!**/dist/**dist/utils/create-url.d.tsis excluded by!**/dist/**dist/utils/create-url.jsis excluded by!**/dist/**dist/utils/function.d.tsis excluded by!**/dist/**dist/utils/function.jsis excluded by!**/dist/**dist/utils/ipv6.d.tsis excluded by!**/dist/**dist/utils/ipv6.jsis excluded by!**/dist/**dist/utils/logger-plugin.d.tsis excluded by!**/dist/**dist/utils/logger-plugin.jsis excluded by!**/dist/**dist/utils/sanitize.d.tsis excluded by!**/dist/**dist/utils/sanitize.jsis excluded by!**/dist/**
📒 Files selected for processing (1)
.gitignore
|
Thanks for opening the PR Improved the implementation and added some test. (Added you as co-author) |
Description
As described in #929, the old code has a serious performance issue:
This recreates a new buffer from the previous buffer for every chunk. Additionally the copied previous buffer is larger for every chunk so this gives exponentially worse performance the larger the buffer.
Motivation and Context
Logging from old code:
Logging from new code:
How has this been tested?
Test suite still passes (at least - as well as it did before - ipv6 tests fail on my machine before and after).
Build has been run and manual testing of new JS performed to prove the buffering works correctly.
Types of changes
Checklist:
No other updates are required.
Summary by CodeRabbit
Bug Fixes
Chores