fix(telegram): add request timeout for notifications
Deploy / Test, build and deploy (push) Failing after 6m3s

This commit is contained in:
2026-07-08 04:59:24 +04:00
parent 57e723db65
commit b76fd546fe
8 changed files with 236 additions and 35 deletions
+14 -6
View File
@@ -66,12 +66,14 @@ type DBConfig struct {
}
type TelegramConfig struct {
BotToken string `env:"BOT_TOKEN"`
ChatID int64 `env:"CHAT_ID"`
NotifyInfo bool `env:"NOTIFY_INFO" envDefault:"true"`
NotifyWarn bool `env:"NOTIFY_WARN" envDefault:"true"`
NotifyAlert bool `env:"NOTIFY_ALERT" envDefault:"true"`
NotifyReport bool `env:"NOTIFY_REPORT" envDefault:"true"`
BotToken string `env:"BOT_TOKEN"`
ChatID int64 `env:"CHAT_ID"`
NotifyInfo bool `env:"NOTIFY_INFO" envDefault:"true"`
NotifyWarn bool `env:"NOTIFY_WARN" envDefault:"true"`
NotifyAlert bool `env:"NOTIFY_ALERT" envDefault:"true"`
NotifyReport bool `env:"NOTIFY_REPORT" envDefault:"true"`
RequestTimeoutSec int `env:"REQUEST_TIMEOUT_SEC" envDefault:"10"`
QueueSize int `env:"QUEUE_SIZE" envDefault:"256"`
}
type StrategyConfig struct {
@@ -201,6 +203,12 @@ func (c *Config) Validate() error {
if c.TInvest.RequestTimeoutSec <= 0 {
return errors.New("TINVEST_REQUEST_TIMEOUT_SEC must be positive")
}
if c.Telegram.RequestTimeoutSec <= 0 {
return errors.New("TELEGRAM_REQUEST_TIMEOUT_SEC must be positive")
}
if c.Telegram.QueueSize <= 0 {
return errors.New("TELEGRAM_QUEUE_SIZE must be positive")
}
if c.TInvest.TradingCalendarExchange == "" {
c.TInvest.TradingCalendarExchange = "MOEX"
}