Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -918,7 +918,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "noleader"
|
name = "noleader"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-nats",
|
"async-nats",
|
||||||
|
|||||||
@@ -133,6 +133,8 @@ impl Leader {
|
|||||||
F: Fn(CancellationToken) -> Fut,
|
F: Fn(CancellationToken) -> Fut,
|
||||||
Fut: Future<Output = anyhow::Result<()>> + Send + 'static,
|
Fut: Future<Output = anyhow::Result<()>> + Send + 'static,
|
||||||
{
|
{
|
||||||
|
let cancellation_token = cancellation_token.child_token();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if cancellation_token.is_cancelled() {
|
if cancellation_token.is_cancelled() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
@@ -170,6 +172,7 @@ impl Leader {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tracing::info!("starting leader actions");
|
||||||
let res = f(child_token).await;
|
let res = f(child_token).await;
|
||||||
|
|
||||||
guard.abort();
|
guard.abort();
|
||||||
|
|||||||
Reference in New Issue
Block a user