5 分钟发布一次

This commit is contained in:
yml2213
2026-06-27 22:26:37 +08:00
parent 3abd513543
commit fed7d6af71
10 changed files with 261 additions and 9 deletions
@@ -5,6 +5,7 @@ import (
"encoding/json"
"strconv"
"strings"
"time"
)
func (s *Service) reviewRequired(ctx context.Context) (bool, error) {
@@ -42,3 +43,21 @@ func (s *Service) publishRules(ctx context.Context) (publishRules, error) {
}
return rules, nil
}
func (s *Service) publishCooldown(ctx context.Context) (time.Duration, error) {
if s.config == nil {
return time.Duration(defaultPublishCooldownMinutes) * time.Minute, nil
}
value, err := s.config.FindValue(ctx, publishCooldownMinutesKey)
if err != nil {
return 0, err
}
minutes, err := strconv.Atoi(strings.TrimSpace(value))
if err != nil {
return time.Duration(defaultPublishCooldownMinutes) * time.Minute, nil
}
if minutes <= 0 {
return 0, nil
}
return time.Duration(minutes) * time.Minute, nil
}