Only update the Feed object once per reconcile (#232)
Only update the Feed object once per reconcile (#232)

* Only update the Feed object once per reconcile

Updating the Feed multiple times in a single reconcile causes a race
condition for updates after the first. The controller-runtime client
always serves Get requests from cache (informers) and the cache may
not have been synced with the N-1 update when update N happens, causing
a resourceVersion mismatch.

To avoid this race, update finalizers, object references, and status all
in the same request. This should be the same behavior as before because
all code paths execute the update once the Feed object has been
modified.

* Rename err to avoid shadowing

The intent and result of the code is the same, but this version is
easier to understand and vet no longer complains.

knative/eventing,knative/eventing