5 分钟发布一次
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user