Skip to content

Commit

Permalink
fud v3
Browse files Browse the repository at this point in the history
  • Loading branch information
mariari committed Nov 3, 2023
1 parent bfea2f7 commit e05962e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,16 @@ where
match listener_clone.accept().await {
Ok((socket, _addr)) => {
if let Err(e) = conn.clone().run(socket).await {
Err(backoff::Error::Permanent(e))
match e.downcast::<tower::load_shed::error::Overloaded>() {
Err(e) => {
tracing::error!({ %e }, "error in a connection handler");
return Err(backoff::Error::Permanent(e))
}
Ok(e) => {
tracing::warn!("Service overloaded - backing off");
return Err(backoff::Error::transient(e));
}
}
} else {
Ok(())
}
Expand All @@ -191,7 +200,7 @@ where
}
}
}
);
).await;
});
}
}
Expand Down

0 comments on commit e05962e

Please sign in to comment.