mirror of
https://git.asonix.dog/asonix/pict-rs.git
synced 2024-11-28 12:31:00 +00:00
put timeout on collecting payloads
This commit is contained in:
parent
961de20a00
commit
7293628148
1 changed files with 4 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
use std::{
|
||||
future::{ready, Ready},
|
||||
rc::Rc,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use actix_web::{
|
||||
|
@ -18,10 +19,11 @@ async fn drain(rx: flume::Receiver<actix_web::dev::Payload>) {
|
|||
let mut set = JoinSet::new();
|
||||
|
||||
while let Ok(payload) = rx.recv_async().await {
|
||||
set.spawn_local(async move {
|
||||
// draining a payload is a best-effort task - if we can't collect in 2 minutes we bail
|
||||
set.spawn_local(tokio::time::timeout(Duration::from_secs(120), async move {
|
||||
let mut streamer = payload.into_streamer();
|
||||
while streamer.next().await.is_some() {}
|
||||
});
|
||||
}));
|
||||
|
||||
let mut count = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue