nats-io / nats.rs

Rust client for NATS, the cloud native messaging system.
Apache License 2.0
1.04k stars 164 forks source link

Don't force flush if write buffer isn't empty #1241

Closed paolobarbolini closed 5 months ago

paolobarbolini commented 5 months ago

It turns out poll_write could return Poll::Pending while poll_flush could flush successfully (Poll::Ready). This seems like a rare case, although possible in theory. This fixes it by actually making it behave the way it was described in the original PR https://github.com/nats-io/nats.rs/pull/1060#issuecomment-1657242359

paolobarbolini commented 5 months ago

Hold on I think I see why I added is_flushing: we need some way of notifying the flush observers if there's nothing to flush :sweat_smile: