Documentation ¶
Index ¶
- func After(d time.Duration) *time.Time
- func ExpandEnv(args map[string]interface{}, flag string, allowEmpty bool) string
- func ExpandEnvUUID(args map[string]interface{}, flag string) uuid.UUID
- func GetSanitizedArgs() []string
- func InSkipNamespace(skipNamespacePatterns []string, namespace string) bool
- func MustParseDuration(args map[string]interface{}, flag string) time.Duration
- func MustParseInt(args map[string]interface{}, flag string) int
- func SetLogger(logger *log.Logger)
- func Throttle(name string, interval time.Duration, tickLimit int32, ...) func(args ...interface{})
- func TruncateString(str string, num int) string
- func WithBackoff(fn func() error, backoff Backoff, logger *log.Logger) error
- type Backoff
- type Ticker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandEnvUUID ¶
func GetSanitizedArgs ¶
func GetSanitizedArgs() []string
func InSkipNamespace ¶
func MustParseDuration ¶
func MustParseInt ¶
func TruncateString ¶
func WithBackoff ¶
Types ¶
type Ticker ¶
type Ticker struct {
// contains filtered or unexported fields
}
func (*Ticker) Start ¶
Start starts ticker. If immediate is true, the ticker tick immediately and blocks for this tick. If async is true, each tick firing will run in a different goroutine. Else, the tick in the same goroutine as the ticker itself. If block is true, Start will block the ticker forever. Else, the ticker will run in a different goroutine.
Note: when using async flag: 1. if it is true, you may need to apply needed synchronization between ticks. Also note that, ticks waiters may got a newer tick unlocking them.
2. if it is false, the ticker applies the needed synchronizations. In that case the ticker don't tick the next one unless the old tick finishes. So you may got inconsistent ticks intervals if a tick takes time larger than the tick interval to finish. So please consider timeouts if consistent ticks are needed.
func (*Ticker) WaitForNextTick ¶
func (ticker *Ticker) WaitForNextTick() chan struct{}
WaitForNextTick returns a signal channel that gets unblocked after the next tick Example usage:
<- ticker.WaitForNextTick()