Skip to content

Commit

Permalink
prepare v0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
glendc committed Sep 5, 2023
1 parent 8909251 commit 598013c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# 0.1.1 (06. September, 2023)

- Improved documentation and add FAQ to readme;
- Optimization to the `into_spawn*` methods (don't clone first);
- add CI semver check;

# 0.1.0 (05. September, 2023)

- Initial release.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
categories = ["asynchronous", "network-programming"]
edition = "2021"
name = "tokio-graceful"
version = "0.1.0"
version = "0.1.1"
description = "util for graceful shutdown of tokio applications"
homepage = "https://github.com/plabayo/tokio-graceful"
readme = "README.md"
Expand Down
8 changes: 6 additions & 2 deletions src/guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ impl ShutdownGuard {
T: Future + Send + 'static,
T::Output: Send + 'static,
{
self.spawn_task(task)
tokio::spawn(async move {
let output = task.await;
drop(self);
output
})
}

/// Returns a Tokio [`JoinHandle`] that can be awaited on
Expand Down Expand Up @@ -125,7 +129,7 @@ impl ShutdownGuard {
T: Future + Send + 'static,
T::Output: Send + 'static,
{
self.spawn_task_fn(task)
tokio::spawn(async move { task(self).await })
}

/// Downgrades the guard to a [`WeakShutdownGuard`],
Expand Down

0 comments on commit 598013c

Please sign in to comment.