mirror of https://github.com/dapr/kit.git
parent
b1c323eb83
commit
0032beeca8
|
@ -15,9 +15,6 @@ package loop
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"sync/atomic"
|
|
||||||
|
|
||||||
"github.com/dapr/kit/concurrency/fifo"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type HandlerFunc[T any] func(context.Context, T) error
|
type HandlerFunc[T any] func(context.Context, T) error
|
||||||
|
@ -31,8 +28,6 @@ type Loop[T any] struct {
|
||||||
handler HandlerFunc[T]
|
handler HandlerFunc[T]
|
||||||
|
|
||||||
closeCh chan struct{}
|
closeCh chan struct{}
|
||||||
closed atomic.Bool
|
|
||||||
lock fifo.Mutex
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func New[T any](opts Options[T]) *Loop[T] {
|
func New[T any](opts Options[T]) *Loop[T] {
|
||||||
|
|
|
@ -18,7 +18,6 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/utils/clock"
|
|
||||||
kclock "k8s.io/utils/clock"
|
kclock "k8s.io/utils/clock"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -45,7 +44,7 @@ type Processor[K comparable, T Queueable[K]] struct {
|
||||||
func NewProcessor[K comparable, T Queueable[K]](opts Options[K, T]) *Processor[K, T] {
|
func NewProcessor[K comparable, T Queueable[K]](opts Options[K, T]) *Processor[K, T] {
|
||||||
cl := opts.Clock
|
cl := opts.Clock
|
||||||
if cl == nil {
|
if cl == nil {
|
||||||
cl = clock.RealClock{}
|
cl = kclock.RealClock{}
|
||||||
}
|
}
|
||||||
return &Processor[K, T]{
|
return &Processor[K, T]{
|
||||||
executeFn: opts.ExecuteFn,
|
executeFn: opts.ExecuteFn,
|
||||||
|
|
Loading…
Reference in New Issue