fix: rm deadlock

This commit is contained in:
Aravinth Manivannan 2023-05-25 14:30:25 +05:30
parent 2aa4be8248
commit 815ef693a1
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88

View file

@ -394,20 +394,19 @@ impl RaftStorage<ExampleTypeConfig> for Arc<ExampleStore> {
EntryPayload::Blank => res.push(ExampleResponse::Empty),
EntryPayload::Normal(ref req) => match req {
ExampleRequest::AddVisitor(msg) => {
let sm = self.state_machine.read().await;
res.push(ExampleResponse::AddVisitorResult(
sm.data
.master
.send(msg.clone())
.await
.unwrap()
.await
.unwrap()
.unwrap(),
));
let r = sm
.data
.master
.send(msg.clone())
.await
.unwrap()
.await
.unwrap()
.unwrap();
res.push(ExampleResponse::AddVisitorResult(r));
}
ExampleRequest::AddCaptcha(msg) => {
let sm = self.state_machine.read().await;
sm.data
.master
.send(msg.clone())
@ -419,7 +418,6 @@ impl RaftStorage<ExampleTypeConfig> for Arc<ExampleStore> {
res.push(ExampleResponse::Empty);
}
ExampleRequest::RenameCaptcha(msg) => {
let sm = self.state_machine.read().await;
sm.data
.master
.send(msg.clone())
@ -431,7 +429,6 @@ impl RaftStorage<ExampleTypeConfig> for Arc<ExampleStore> {
res.push(ExampleResponse::Empty);
}
ExampleRequest::RemoveCaptcha(msg) => {
let sm = self.state_machine.read().await;
sm.data
.master
.send(msg.clone())