chore: update dependencies and refactor webhook handling
- Added new dependencies for SQLite support and improved HTTP client functionality in go.mod and go.sum. - Refactored webhook server implementation to utilize a simplified version, enhancing code maintainability. - Updated API client to leverage a generic request method, streamlining API interactions. - Modified configuration to include access token for webhook server, improving security. - Enhanced event handling and request processing in the API client for better performance.
This commit is contained in:
@@ -136,14 +136,19 @@ func handleMCSCommand(ctx context.Context, event protocol.Event, botManager *pro
|
||||
Logger: logger,
|
||||
}
|
||||
|
||||
// 使用独立的 context 进行截图,避免受 dispatcher context 影响
|
||||
// 如果 dispatcher context 被取消,截图操作仍能完成
|
||||
screenshotCtx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
|
||||
// 使用独立的 context 进行截图,完全避免受外部 context 影响
|
||||
// 使用更长的超时时间,避免频繁失败
|
||||
screenshotCtx, cancel := context.WithTimeout(context.Background(), 90*time.Second)
|
||||
defer cancel()
|
||||
|
||||
// 渲染并截图
|
||||
chain, err := utils.ScreenshotHTMLToMessageChain(screenshotCtx, htmlTemplate, opts)
|
||||
if err != nil {
|
||||
// context.Canceled 是应用关闭时的正常行为,不记录为错误
|
||||
if err.Error() == "screenshot operation was canceled" {
|
||||
logger.Warn("Screenshot canceled due to application shutdown")
|
||||
return nil
|
||||
}
|
||||
logger.Error("Failed to render status image", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user