mirror of
https://github.com/rancher/norman.git
synced 2025-09-02 15:54:32 +00:00
Add ignorable error to bypass requeue
This commit is contained in:
9
controller/error.go
Normal file
9
controller/error.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package controller
|
||||||
|
|
||||||
|
type ForgetError struct {
|
||||||
|
Err error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *ForgetError) Error() string {
|
||||||
|
return f.Err.Error()
|
||||||
|
}
|
@@ -162,7 +162,7 @@ func (g *genericController) processNextWorkItem() bool {
|
|||||||
|
|
||||||
// do your work on the key. This method will contains your "do stuff" logic
|
// do your work on the key. This method will contains your "do stuff" logic
|
||||||
err := g.syncHandler(key.(string))
|
err := g.syncHandler(key.(string))
|
||||||
if err == nil {
|
if _, ok := err.(*ForgetError); err == nil || ok {
|
||||||
g.queue.Forget(key)
|
g.queue.Forget(key)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user