diff --git a/pkg/support/throttling/throttler.go b/pkg/support/throttling/throttler.go index f8e94e9..04b6b37 100644 --- a/pkg/support/throttling/throttler.go +++ b/pkg/support/throttling/throttler.go @@ -6,6 +6,10 @@ import ( // Throttling notifications to prometheus and web clients // TO be used in a single-threaded manner. +// +// NOTE: the null value of type T is considered as a not-set value. +// +// The best usage of Throttler is with a pointer type. type Throttler[T comparable] struct { minDelay time.Duration // ucntion to call to implement the notification. @@ -49,7 +53,6 @@ func (throttler *Throttler[T]) Notify(value T) { // notification was sent is long enough ago. func (throttler *Throttler[T]) Ping() { if throttler.pendingValue != *new(T) { - // TODO improve: use a better way to recognize that there is a pending value. throttler.Notify(throttler.pendingValue) } }