fix: wire retry into router, fix Docker config path, fix condition error handling, remove dead code

This commit is contained in:
2026-06-27 13:32:33 +08:00
parent 062014773c
commit 835b92ec00
3 changed files with 25 additions and 21 deletions
+6 -9
View File
@@ -9,16 +9,10 @@ import (
"aiaa-notification-service/internal/adapter"
"aiaa-notification-service/internal/cache"
"aiaa-notification-service/internal/model"
"aiaa-notification-service/internal/retry"
"aiaa-notification-service/internal/store"
)
type SendResult struct {
ChannelType string `json:"channel_type"`
ChannelID int `json:"channel_id"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
type Router struct {
store *store.Store
cache *cache.Cache
@@ -51,8 +45,11 @@ func (r *Router) Route(ctx context.Context, rule *model.Rule, title, content str
if ch.Config != nil {
cfg = *ch.Config
}
if err := s.Send(title, content, cfg); err != nil {
slog.Error("send failed", "channel_type", ch.Type, "channel_id", ch.ID, "error", err)
r := retry.DefaultRetrier()
if err := r.Do(context.Background(), func() error {
return s.Send(title, content, cfg)
}); err != nil {
slog.Error("send failed after retries", "channel_type", ch.Type, "channel_id", ch.ID, "error", err)
} else {
slog.Info("sent", "channel_type", ch.Type, "channel_id", ch.ID)
}