Skip to content

Conversation

@mdedetrich
Copy link
Contributor

@mdedetrich mdedetrich commented Nov 9, 2025

One interesting facet when working on the compression code is that while the compress method in CompressionUtils is used in tests, its actually never actually used in production for any of the pekko-stream compresion methods. Only compressAndFlush is used in production, hence this PR makes the flush behaviour of pekko-stream compression configurable, solving akka/akka-core#21849.

Tests have been added to make sure that this behaviour works as expected. Also this PR is required for #2409 as I also want the flush behaviour to be configurable in that PR too and so I need to reuse the newly added autoFlush parameter on CompressionUtils. Docs have also been modified to reflect the changes.

The PR can be safely backported to 1.3.0 branch hence the @since 1.3.0.

}

"be able to decode chunk-by-chunk (depending on input chunks)" in {
assume(autoFlush)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is only valid when you flush on each element on the stream as its testing that each individual element can be decompressed on its own and that is not the case when you have autoFlush disabled

case object AllDataAllowed extends Exception with NoStackTrace
protected def corruptInputCheck: Boolean = true

protected def autoFlush: Boolean = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does that need flush interval too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, having an interval based flush with compression would yield wild results

Copy link
Member

@He-Pin He-Pin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mdedetrich mdedetrich merged commit 274d704 into apache:main Nov 10, 2025
9 checks passed
@mdedetrich mdedetrich deleted the make-auto-flush-configurable branch November 10, 2025 07:27
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.

2 participants