@@ -549,10 +549,7 @@ func (a *Agent) schedulePendingFlushRetry(now time.Time) time.Duration {
|
||||
jitter = time.Duration(a.randomInt63n(int64(jitterRange)*2+1)) - jitterRange
|
||||
}
|
||||
|
||||
retryIn := nextBase + jitter
|
||||
if retryIn < time.Second {
|
||||
retryIn = time.Second
|
||||
}
|
||||
retryIn := max(nextBase+jitter, time.Second)
|
||||
a.pendingFlushRetryAt = now.Add(retryIn)
|
||||
return retryIn
|
||||
}
|
||||
|
||||
@@ -116,8 +116,8 @@ func darwinScreenLockMode(raw string) (string, int, bool) {
|
||||
if strings.Contains(lower, "off") {
|
||||
return "off", -1, true
|
||||
}
|
||||
if idx := strings.Index(lower, "seconds"); idx >= 0 {
|
||||
prefix := strings.Fields(lower[:idx])
|
||||
if before, _, ok := strings.Cut(lower, "seconds"); ok {
|
||||
prefix := strings.Fields(before)
|
||||
if len(prefix) == 0 {
|
||||
return "seconds", -1, true
|
||||
}
|
||||
|
||||
@@ -75,12 +75,12 @@ func extractValue(s, key string) string {
|
||||
rest = strings.TrimPrefix(rest, ">")
|
||||
if strings.HasPrefix(rest, "\"") {
|
||||
rest = rest[1:]
|
||||
end := strings.Index(rest, "\"")
|
||||
if end < 0 {
|
||||
before, _, ok := strings.Cut(rest, "\"")
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
|
||||
return strings.TrimSpace(rest[:end])
|
||||
return strings.TrimSpace(before)
|
||||
}
|
||||
|
||||
end := strings.IndexAny(rest, "\r\n")
|
||||
|
||||
@@ -563,7 +563,7 @@ func readChecksum(path, archiveName string) (string, error) {
|
||||
return "", fmt.Errorf("cannot read checksums: %w", err)
|
||||
}
|
||||
|
||||
for _, line := range strings.Split(string(data), "\n") {
|
||||
for line := range strings.SplitSeq(string(data), "\n") {
|
||||
line = strings.TrimSpace(line)
|
||||
if line == "" {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user