mirror of
https://codeberg.org/icewind/docker-hub-rss.git
synced 2026-06-03 18:24:06 +02:00
sigint handling
This commit is contained in:
parent
6f96bd5133
commit
dc07e0ed7c
1 changed files with 8 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ mod hub;
|
|||
use crate::hub::Hub;
|
||||
use color_eyre::{Report, Result};
|
||||
use rss::{Channel, ChannelBuilder, GuidBuilder, ItemBuilder};
|
||||
use tokio::signal::unix::{signal, SignalKind};
|
||||
use warp::reject::Reject;
|
||||
use warp::{Filter, Rejection};
|
||||
|
||||
|
|
@ -17,7 +18,13 @@ async fn main() -> Result<()> {
|
|||
let feed_route = warp::path!(String / String).and(hub).and_then(feed);
|
||||
let routes = feed_route.clone().or(warp::path!("r" / ..).and(feed_route));
|
||||
|
||||
warp::serve(routes).run(([0, 0, 0, 0], port)).await;
|
||||
let mut int = signal(SignalKind::interrupt())?;
|
||||
warp::serve(routes)
|
||||
.bind_with_graceful_shutdown(([0, 0, 0, 0], port), async move {
|
||||
int.recv().await;
|
||||
})
|
||||
.1
|
||||
.await;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue