Skip to content

Commit

Permalink
check lock readiness in poll_ready()
Browse files Browse the repository at this point in the history
  • Loading branch information
neuronull committed Apr 10, 2023
1 parent 9e85fe9 commit 12111d2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sinks/pulsar/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ impl<Exe: Executor> Service<PulsarRequest> for PulsarService<Exe> {
type Future = BoxFuture<'static, Result<Self::Response, Self::Error>>;

fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))
match self.producer.try_lock() {
Ok(_) => Poll::Ready(Ok(())),
Err(_) => Poll::Pending,
}
}

fn call(&mut self, request: PulsarRequest) -> Self::Future {
Expand Down

0 comments on commit 12111d2

Please sign in to comment.