1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-23 23:51:06 +01:00

actix-ws: take the encoded buffer when yielding rather than split it (#435)

* actix-ws: take the encoded buffer when yielding rather than split it

* actix-ws: add memory reduction to changelog

---------

Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
asonix 2024-06-09 00:06:24 -05:00 committed by GitHub
parent 3ae4ef2706
commit 8195484415
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@
## Unreleased ## Unreleased
- Take the encoded buffer when yielding bytes in the response stream rather than splitting the buffer, reducing memory use
- Remove type parameters from `Session::{text, binary}()` methods, replacing with equivalent `impl Trait` parameters. - Remove type parameters from `Session::{text, binary}()` methods, replacing with equivalent `impl Trait` parameters.
- `Session::text()` now receives an `impl Into<ByteString>`, making broadcasting text messages more efficient. - `Session::text()` now receives an `impl Into<ByteString>`, making broadcasting text messages more efficient.
- Allow sending continuations via `Session::continuation()` - Allow sending continuations via `Session::continuation()`

View File

@ -108,7 +108,7 @@ impl Stream for StreamingBody {
} }
if !this.buf.is_empty() { if !this.buf.is_empty() {
return Poll::Ready(Some(Ok(this.buf.split().freeze()))); return Poll::Ready(Some(Ok(std::mem::take(&mut this.buf).freeze())));
} }
Poll::Pending Poll::Pending