Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutex in producer::TopicProducer is unnecessary #283

Open
dojiong opened this issue Jun 13, 2023 · 0 comments
Open

Mutex in producer::TopicProducer is unnecessary #283

dojiong opened this issue Jun 13, 2023 · 0 comments

Comments

@dojiong
Copy link

dojiong commented Jun 13, 2023

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?

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

No branches or pull requests

1 participant