mirror of
https://github.com/kubernetes/sample-controller.git
synced 2025-01-31 17:02:52 +08:00
Requeue work item on syncHandler error
Kubernetes-commit: 8f86654b8e23bbf960a286712df35c003f7389f8
This commit is contained in:
parent
7ee81ff4ae
commit
94e9a85e76
@ -219,7 +219,9 @@ func (c *Controller) processNextWorkItem() bool {
|
|||||||
// Run the syncHandler, passing it the namespace/name string of the
|
// Run the syncHandler, passing it the namespace/name string of the
|
||||||
// Foo resource to be synced.
|
// Foo resource to be synced.
|
||||||
if err := c.syncHandler(key); err != nil {
|
if err := c.syncHandler(key); err != nil {
|
||||||
return fmt.Errorf("error syncing '%s': %s", key, err.Error())
|
// Put the item back on the workqueue to handle any transient errors.
|
||||||
|
c.workqueue.AddRateLimited(key)
|
||||||
|
return fmt.Errorf("error syncing '%s': %s, requeuing", key, err.Error())
|
||||||
}
|
}
|
||||||
// Finally, if no error occurs we Forget this item so it does not
|
// Finally, if no error occurs we Forget this item so it does not
|
||||||
// get queued again until another change happens.
|
// get queued again until another change happens.
|
||||||
|
Loading…
Reference in New Issue
Block a user