Page MenuHomePhabricator

D13608.id44905.diff
No OneTemporary

D13608.id44905.diff

diff --git a/services/tunnelbroker/src/amqp.rs b/services/tunnelbroker/src/amqp.rs
--- a/services/tunnelbroker/src/amqp.rs
+++ b/services/tunnelbroker/src/amqp.rs
@@ -82,7 +82,10 @@
async fn new() -> Result<Self, lapin::Error> {
let conn = create_connection().await?;
conn.on_error(|err| {
- // TODO: we should filter out some IOErrors here to avoid spamming alerts
+ if should_ignore_error(&err) {
+ debug!("Ignored AMQP Lapin error: {err:?}");
+ return;
+ }
error!(errorType = error_types::AMQP_ERROR, "Lapin error: {err:?}");
});
@@ -139,6 +142,26 @@
}
}
+fn should_ignore_error(err: &lapin::Error) -> bool {
+ use lapin::Error as E;
+ use std::io::ErrorKind;
+
+ if is_connection_error(err) {
+ return true;
+ }
+
+ if let E::IOError(io_error) = err {
+ return match io_error.kind() {
+ // Suppresses: "Socket was readable but we read 0.""
+ // We handle this by auto-reconnecting
+ ErrorKind::ConnectionAborted => true,
+ _ => false,
+ };
+ }
+
+ false
+}
+
pub fn is_connection_error(err: &lapin::Error) -> bool {
matches!(
err,

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 11:20 PM (18 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2563050
Default Alt Text
D13608.id44905.diff (1 KB)

Event Timeline