diff --git a/Cargo.lock b/Cargo.lock index 208a4f51..36ba64ef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2629,7 +2629,7 @@ version = "0.3.0" [[package]] name = "volo-thrift" -version = "0.7.1" +version = "0.7.2" dependencies = [ "anyhow", "async-trait", diff --git a/volo-thrift/Cargo.toml b/volo-thrift/Cargo.toml index f993817f..5e1143b7 100644 --- a/volo-thrift/Cargo.toml +++ b/volo-thrift/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "volo-thrift" -version = "0.7.1" +version = "0.7.2" edition.workspace = true homepage.workspace = true repository.workspace = true diff --git a/volo-thrift/src/codec/default/mod.rs b/volo-thrift/src/codec/default/mod.rs index 59a0850a..e2ecc0bf 100644 --- a/volo-thrift/src/codec/default/mod.rs +++ b/volo-thrift/src/codec/default/mod.rs @@ -134,6 +134,7 @@ impl Encoder cx.stats_mut().set_write_size(real_size); let write_result = (|| async { + self.linked_bytes.reset(); // then we reserve the size of the message in the linked bytes self.linked_bytes.reserve(malloc_size); // after that, we encode the message into the linked bytes @@ -160,8 +161,6 @@ impl Encoder // put write end here so we can also record the time of encode error cx.stats_mut().record_write_end_at(); - // finally, don't forget to reset the linked bytes - self.linked_bytes.reset(); match write_result { Ok(()) => Ok(()), Err(mut e) => {