func (c *Controller) processNextWorkItem() bool {
	obj, shutdown := c.workqueue.Get()

	if shutdown {
		c.logger.Info("Shutting down queue")
		return false
	}

	// We wrap this block in a func so we can defer c.workqueue.Done.
	err := func(obj interface{}) error {
		// We call Done here so the workqueue knows we have finished
		// processing this item. We also must remember to call Forget if we
		// do not want this work item being re-queued. For example, we do
		// not call Forget if a transient error occurs, instead the item is
		// put back on the workqueue and attempted again after a back-off
		// period.
		defer c.workqueue.Done(obj)
		var key string
		var ok bool
		// We expect strings to come off the workqueue. These are of the
		// form namespace/name. We do this as the delayed nature of the
		// workqueue means the items in the informer cache may actually be
		// more up to date that when the item was initially put onto the
		// workqueue.
		if key, ok = obj.(string); !ok {
			// As the item in the workqueue is actually invalid, we call
			// Forget here else we'd go into a loop of attempting to
			// process a work item that is invalid.
			c.workqueue.Forget(obj)
			runtime.HandleError(fmt.Errorf("expected string in workqueue but got %#v", obj))
			return nil
		}

		// Run the syncHandler, passing it the namespace/name string of the
		// Foo resource to be synced.
		if err := c.syncHandler(key); err != nil {
			return fmt.Errorf("error syncing '%s': %s", key, err.Error())
		}

		c.logger.Debugf("Working on %s", obj)

		// Finally, if no error occurs we Forget this item so it does not
		// get queued again until another change happens.
		c.workqueue.Forget(obj)
		glog.Infof("Successfully synced '%s'", key)
		return nil

		// err := c.process(k.(string))

		// if err == nil {
		// 	c.logger.Debugf("Finished Working on %s", k)
		// 	c.queue.Forget(k)
		// 	return true
		// }

		// c.logger.Errorf("Re-queueing as encountered an error: %s", err.Error())

		// c.queue.AddRateLimited(k)
	}(obj)

	if err != nil {
		runtime.HandleError(err)
		return true
	}

	return true
}
// processNextWorkItem will read a single work item off the workqueue and
// attempt to process it, by calling the syncHandler.
processNextWorkItem will read a single work item off the workqueue and
attempt to process it, by calling the syncHandler.
// processNextWorkItem will read a single work item off the workqueue and // attempt to process it by calling the syncHandler .
func (c *Controller) processNextWorkItem() bool {
	obj, shutdown := c.workqueue.Get()
	if shutdown {
		c.logger.Info("Shutting down queue")
		return false
	}
	err := func(obj interface{}) error {
		defer c.workqueue.Done(obj)
		var key string
		var ok bool
		if key, ok = obj.(string); !ok {
			c.workqueue.Forget(obj)
			runtime.HandleError(fmt.Errorf("expected string in workqueue but got %#v", obj))
			return nil
		}
		if err := c.syncHandler(key); err != nil {
			return fmt.Errorf("error syncing '%s': %s", key, err.Error())
		}
		c.logger.Debugf("Working on %s", obj)
		c.workqueue.Forget(obj)
		glog.Infof("Successfully synced '%s'", key)
		return nil
	}(obj)
	if err != nil {
		runtime.HandleError(err)
		return true
	}
	return true
}
func ( c * Controller ) processNextWorkItem ( ) bool { obj , shutdown := c . workqueue . Get ( ) if shutdown { c . logger . Info ( " " ) return false } err := func ( obj interface { } ) error { defer c . workqueue . Done ( obj ) var key string var ok bool if key , ok = obj . ( string ) ; ! ok { c . workqueue . Forget ( obj ) runtime . HandleError ( fmt . Errorf ( " " , obj ) ) return nil } if err := c . syncHandler ( key ) ; err != nil { return fmt . Errorf ( " " , key , err . Error ( ) ) } c . logger . Debugf ( " " , obj ) c . workqueue . Forget ( obj ) glog . Infof ( " " , key ) return nil } ( obj ) if err != nil { runtime . HandleError ( err ) return true } return true }
processNextWorkItem will read a single work item off the workqueue and
attempt to process it, by calling the syncHandler.
processNextWorkItem will read a single work item off the workqueue and attempt to process it by calling the syncHandler .
// We wrap this block in a func so we can defer c.workqueue.Done. // We call Done here so the workqueue knows we have finished // processing this item. We also must remember to call Forget if we // do not want this work item being re-queued. For example, we do // not call Forget if a transient error occurs, instead the item is // put back on the workqueue and attempted again after a back-off // period. // We expect strings to come off the workqueue. These are of the // form namespace/name. We do this as the delayed nature of the // workqueue means the items in the informer cache may actually be // more up to date that when the item was initially put onto the // workqueue. // As the item in the workqueue is actually invalid, we call // Forget here else we'd go into a loop of attempting to // process a work item that is invalid. // Run the syncHandler, passing it the namespace/name string of the // Foo resource to be synced. // Finally, if no error occurs we Forget this item so it does not // get queued again until another change happens. // err := c.process(k.(string)) // if err == nil { // 	c.logger.Debugf("Finished Working on %s", k) // 	c.queue.Forget(k) // 	return true // } // c.logger.Errorf("Re-queueing as encountered an error: %s", err.Error()) // c.queue.AddRateLimited(k)