Files
query-orchestration/internal/backgroundtask/options.go
T
2025-08-12 06:37:16 -07:00

20 lines
452 B
Go

package backgroundtask
import (
"fmt"
"time"
)
// WithInterval sets the interval between periodic work executions.
// The interval must be between MinInterval and MaxInterval.
func WithInterval(d time.Duration) Option {
return func(r *Runner) error {
if d < MinInterval || d > MaxInterval {
return fmt.Errorf("%w: got %v, must be between %v and %v",
ErrInvalidInterval, d, MinInterval, MaxInterval)
}
r.interval = d
return nil
}
}