Skip to content

Commit

Permalink
fix: Abort lease_keepalive_task when EtcdLockManager lock request tim…
Browse files Browse the repository at this point in the history
…eout
  • Loading branch information
jopemachine committed May 13, 2024
1 parent a726848 commit 7f2b1b3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lock_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ impl EtcdLockManager {
None => ready(Ok(self.try_lock(&mut client).await)).await,
};

if let Some(ref lease_keepalive_task) = self.lease_keepalive_task {
lease_keepalive_task.abort();
}

match timeout_result {
Ok(Ok(_)) => {}
Ok(Err(e)) => return Err(e.into()),
Expand All @@ -129,10 +133,6 @@ impl EtcdLockManager {
}
}

if let Some(ref lease_keepalive_task) = self.lease_keepalive_task {
lease_keepalive_task.abort();
}

Ok(PyCommunicator::new(client))
}

Expand Down

0 comments on commit 7f2b1b3

Please sign in to comment.