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
This complements the existing handlers for creation/update/deletion cases, and is triggered when the object is neither created, nor updated, nor deleted, but the operator has started/restarted, and needs to be aware of that object somehow.
As a side-note: I could not decide between "resume" and "recall" for proper naming. It is "resume", as it resumes some thread that was previously running in a now-dead operator. It is "recall", as it kind of "recalls" (remembers) the object: "ah, there is also such a thing with uid 123, which is not changed!". The naming can be changed before merged.
Types of Changes
New feature (non-breaking change which adds functionality)
I expect that the thread is started either when a new object is created and the operator is running for some time, or when the object exists for some time and the operator has just restarted (i.e. either one is fresh new).
However, if the object was changed (e.g. its status) before the crash or restart, the UPDATE cause is detected, and the @kopf.on.update handlers are called. The @kopf.on.resume handlers are NOT called in case the object was changed — this breaks the intuitive expectations and semantics of a background thread starter (the original purpose of this handler).
Starting the threads from the UPDATE/DELETE handlers is not desired, as it means we have to keep track of the thread pool state per object — extra hassle.
The RESUME cause has to be handled even if the object has changed (but maybe not if deleted) — before or after the UPDATE handler in the same handling cycle.
PS: Or maybe there is no RESUME cause at all, and the @kopf.on.resume handlers are more like the event-handlers (@kopf.on.event), just happening on the initial object listing (maybe: and on creation), and not happening later.
Description
Add the handlers for "resuming" (recalling? remembering?) an object in the operator:
This complements the existing handlers for creation/update/deletion cases, and is triggered when the object is neither created, nor updated, nor deleted, but the operator has started/restarted, and needs to be aware of that object somehow.
As a side-note: I could not decide between "resume" and "recall" for proper naming. It is "resume", as it resumes some thread that was previously running in a now-dead operator. It is "recall", as it kind of "recalls" (remembers) the object: "ah, there is also such a thing with uid 123, which is not changed!". The naming can be changed before merged.
Types of Changes
Review
The first experience using it:
If I write
I expect that the thread is started either when a new object is created and the operator is running for some time, or when the object exists for some time and the operator has just restarted (i.e. either one is fresh new).
However, if the object was changed (e.g. its status) before the crash or restart, the
UPDATE
cause is detected, and the@kopf.on.update
handlers are called. The@kopf.on.resume
handlers are NOT called in case the object was changed — this breaks the intuitive expectations and semantics of a background thread starter (the original purpose of this handler).Starting the threads from the
UPDATE
/DELETE
handlers is not desired, as it means we have to keep track of the thread pool state per object — extra hassle.The
RESUME
cause has to be handled even if the object has changed (but maybe not if deleted) — before or after theUPDATE
handler in the same handling cycle.PS: Or maybe there is no
RESUME
cause at all, and the@kopf.on.resume
handlers are more like the event-handlers (@kopf.on.event
), just happening on the initial object listing (maybe: and on creation), and not happening later.Replaced by an alternative approach in #105, which feels more intuitive.
The text was updated successfully, but these errors were encountered: