You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created Reconciler on primary resource and CRUDKubernetesDependentResource connected with it. On the next step i triggered reconciliation which should update dependent resource.
What did you expect to see?
Single call of desired method
What did you see instead? Under which circumstances?
Two calls of desired method - second is redundant.
Additional context
After analysis i assume the root cause is HERE. The desired method is called here even if Optional returned from computedDesired has value. It's a pretty common mistake during using optionals, that orElse is called instead of orElseGet when we really need lazy evaluation.
Possible Solution
Just make desired call lazily evaluated by using orElseGet ;)
Environment
$ Mention java-operator-sdk version from pom.xml file
3.1.1
The text was updated successfully, but these errors were encountered:
Bug Report
What did you do?
I created Reconciler on primary resource and CRUDKubernetesDependentResource connected with it. On the next step i triggered reconciliation which should update dependent resource.
What did you expect to see?
Single call of
desired
methodWhat did you see instead? Under which circumstances?
Two calls of
desired
method - second is redundant.Additional context
After analysis i assume the root cause is HERE. The
desired
method is called here even if Optional returned fromcomputedDesired
has value. It's a pretty common mistake during using optionals, thatorElse
is called instead oforElseGet
when we really need lazy evaluation.Possible Solution
Just make
desired
call lazily evaluated by usingorElseGet
;)Environment
$ Mention java-operator-sdk version from pom.xml file
3.1.1
The text was updated successfully, but these errors were encountered: