-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: GZIP #109
feat: GZIP #109
Conversation
🦋 Changeset detectedLatest commit: 0bf82ae The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor questions but impl looks correct.
This is difficult for me to answer given that we don't have any fully-integrated tests or working examples. Does the user-facing API change? No more Is it possible that messages will be processed out-of-order if an early message takes a very long time to decompress, while a later message takes a short time to decompress? If the answer to both of these questions is "no," then this is fine. Otherwise, something somewhere needs to change. |
Update: We determined that there is an out-of-order processing bug in this PR. The high-level solution will be to have a queue of |
This adds
withCompression
method on DbConnection with the optionsgzip | none
. We are dropping brotli here and erroring out anywhere where we recieve a brotli message back.For GZIP, we are using the built-in
DecompressionStream('gzip')
constructor which is compatible with Chrome 80 onwards and NodeJS 17+. This is a standard parser run at the system level by the browser/platform rather than the heavy userland brotli.js, saving us from any inconsistency from userland solutions.As soon as
DecompressionStream('brotli')
gains minimum viable support, we will add that as an option as well. Tracking this issue whatwg/compression#34This brings down our bundle size from 72.1KB min+br to just 7.2KB! 🎉
Main change
DecompressionStream is a stream, aka it is asynchronous. This means we need to add a bunch of async and awaits wherever the decoding is going on. Is that going to affect us?