Skip to content
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

Only compress a message once #8

Merged
merged 1 commit into from
Aug 13, 2013
Merged

Only compress a message once #8

merged 1 commit into from
Aug 13, 2013

Conversation

eapache
Copy link
Contributor

@eapache eapache commented Aug 13, 2013

@burke @fw42

It occurred to me recently that due to the two-pass nature of message encoding, compressed messages were getting compressed twice when encoded, which was rather inefficient.

This is the simple, obvious fix for that issue - when encoding a compressed message, just store the compressed version back in the message body and set the Codec to COMPRESSION_NONE so we don't try and compress it again.

@burke
Copy link
Contributor

burke commented Aug 13, 2013

Looks good to me. :shipit:

eapache added a commit that referenced this pull request Aug 13, 2013
@eapache eapache merged commit 0d0b110 into master Aug 13, 2013
@eapache eapache deleted the compress-once-only branch August 13, 2013 16:50
eapache pushed a commit that referenced this pull request Aug 22, 2013
Fixes #20.

Pull request #8 introduced a bug where the flag indicating which compression
format was used wouldn't be correctly set in the outgoing message. Instead of
overriding the Value field (which would also be confusing for people trying to
use it after sending) we cache the compressed payload in a separate hidden
field, and don't change the compression flags.

Add some tests to ensure this doesn't happen again.

Bonus fix: error if we don't recognize the compression format.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants