mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-07 23:07:30 +08:00
feat: implement channel healthcheck and sentinel auto-healing
This commit is contained in:
@@ -74,6 +74,16 @@ func (c *TelegramChannel) SetTranscriber(transcriber *voice.GroqTranscriber) {
|
||||
c.transcriber = transcriber
|
||||
}
|
||||
|
||||
func (c *TelegramChannel) HealthCheck(ctx context.Context) error {
|
||||
if !c.IsRunning() {
|
||||
return fmt.Errorf("telegram bot not running")
|
||||
}
|
||||
hCtx, cancel := withTelegramAPITimeout(ctx)
|
||||
defer cancel()
|
||||
_, err := c.bot.GetMe(hCtx)
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *TelegramChannel) Start(ctx context.Context) error {
|
||||
if c.IsRunning() {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user