pulsar-rs
pulsar-rs copied to clipboard
Mutex in producer::TopicProducer is unnecessary
In the definition of TopicProducer(producer.rs), batch
is Option<Mutex<Batch>>
. But there is no scenes requires this lock, all using mut reference of TopicProducer when sending messages.
// putting it in a mutex because we must send multiple messages at once
// while we might be pushing more messages from elsewhere
batch: Option<Mutex<Batch>>,
Same problem with Batch (here).
// put it in a mutex because the design of Producer requires an immutable TopicProducer,
// so we cannot have a mutable Batch in a send_raw(&mut self, ...)
pub storage: Mutex<BatchStorage>,
Is this a unfinished design for shareable producer?