I need to add some custom metric based on when exactly the decorated function got called: a background job start delay after its scheduled execution time.
Implementation
In addition to simple functions, the decorator now accepts generator functions. That would allow them to run some code just before the decorated function gets called and remember the state.
Plain old hooks are not affected. The change is designed to be backwards-compatible.
Motivation
I need to add some custom metric based on when exactly the decorated function got called: a background job start delay after its scheduled execution time.
Implementation
In addition to simple functions, the decorator now accepts generator functions. That would allow them to run some code just before the decorated function gets called and remember the state.
Plain old hooks are not affected. The change is designed to be backwards-compatible.