File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
crates/openfang-channels/src Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ const MAX_BACKOFF: Duration = Duration::from_secs(60);
2525const INITIAL_BACKOFF : Duration = Duration :: from_secs ( 1 ) ;
2626/// Telegram long-polling timeout (seconds) — sent as the `timeout` parameter to getUpdates.
2727const LONG_POLL_TIMEOUT : u64 = 30 ;
28+ /// Bound startup control-plane calls so a flaky Local Bot API cannot block daemon boot forever.
29+ const STARTUP_API_TIMEOUT : Duration = Duration :: from_secs ( 10 ) ;
2830
2931/// Default Telegram Bot API base URL.
3032const DEFAULT_API_URL : & str = "https://api.telegram.org" ;
@@ -120,6 +122,7 @@ impl TelegramAdapter {
120122 let resp: serde_json:: Value = self
121123 . client
122124 . post ( & url)
125+ . timeout ( STARTUP_API_TIMEOUT )
123126 . json ( & serde_json:: json!( { "commands" : commands } ) )
124127 . send ( )
125128 . await ?
@@ -468,6 +471,7 @@ impl ChannelAdapter for TelegramAdapter {
468471 . client
469472 . post ( & delete_url)
470473 . json ( & serde_json:: json!( { "drop_pending_updates" : true } ) )
474+ . timeout ( STARTUP_API_TIMEOUT )
471475 . send ( )
472476 . await
473477 {
You can’t perform that action at this time.
0 commit comments