fix: improve Telegram gateway error reporting and connection reliability (#9223)
Signed-off-by: Douwe Osinga <douwe@squareup.com> Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
@@ -101,10 +101,12 @@ impl TelegramGateway {
|
|||||||
.ok_or_else(|| anyhow::anyhow!("missing bot_token in platform_config"))?
|
.ok_or_else(|| anyhow::anyhow!("missing bot_token in platform_config"))?
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
Ok(Self {
|
let client = Client::builder()
|
||||||
bot_token,
|
.connect_timeout(std::time::Duration::from_secs(10))
|
||||||
client: Client::new(),
|
.http1_only()
|
||||||
})
|
.build()?;
|
||||||
|
|
||||||
|
Ok(Self { bot_token, client })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn api_url(&self, method: &str) -> String {
|
fn api_url(&self, method: &str) -> String {
|
||||||
@@ -438,7 +440,7 @@ impl Gateway for TelegramGateway {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::error!(error = %e, "Telegram poll error");
|
tracing::error!(error = ?e, "Telegram poll error");
|
||||||
tokio::time::sleep(RETRY_DELAY).await;
|
tokio::time::sleep(RETRY_DELAY).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user