mirror of
https://github.com/rancher/norman.git
synced 2025-08-31 14:51:57 +00:00
Add EnqueueAfter
This commit is contained in:
@@ -50,6 +50,7 @@ type GenericController interface {
|
||||
AddHandler(ctx context.Context, name string, handler HandlerFunc)
|
||||
HandlerCount() int
|
||||
Enqueue(namespace, name string)
|
||||
EnqueueAfter(namespace, name string, after time.Duration)
|
||||
Sync(ctx context.Context) error
|
||||
Start(ctx context.Context, threadiness int) error
|
||||
}
|
||||
@@ -122,6 +123,16 @@ func (g *genericController) Enqueue(namespace, name string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (g *genericController) EnqueueAfter(namespace, name string, after time.Duration) {
|
||||
key := name
|
||||
if namespace != "" {
|
||||
key = namespace + "/" + name
|
||||
}
|
||||
if g.queue != nil {
|
||||
g.queue.AddAfter(key, after)
|
||||
}
|
||||
}
|
||||
|
||||
func (g *genericController) AddHandler(ctx context.Context, name string, handler HandlerFunc) {
|
||||
t := getHandlerTransaction(ctx)
|
||||
if t == nil {
|
||||
|
Reference in New Issue
Block a user