Pass a reason to on.timer callback
GrahamDumpleton opened this issue · comments
Graham Dumpleton commented
Problem
When stacking handlers:
@kopf.on.resume("xxx.test", "workshopenvironments")
@kopf.on.create("xxx.test", "workshopenvironments")
@kopf.on.update("xxx.test", "workshopenvironments")
@kopf.on.timer("xxx.test", "workshopenvironments", interval=15.0)
def workshopenvironment_reconcile(
reason, name, uid, body, workshopsessions_index, patch, memo, logger, **_
):
...
you can't use reason
if on.timer
is one of the handler decorators.
Proposal
Have a reason type for timers and pass it for timer callbacks, or even having reason
passed as None
would avoid the problem. As is, it is likely only resume
and create
you want to distinguish so know when resource first seen so not a problem if reason
is None
for a timer.
Only means to distinguish at the moment is to use param
instead and supply that with different values for each decorator.
Code
No response
Additional information
No response