This change makes the assess_status() method to be deferred until the end of the hook execution. This is to ensure that the (expensive) assess_status() functionality is only run once, even though it may be called multiple times from reactive handlers that need to update the status on the charm. This uses the hookenv.atexit() function to queue an function that calls _assess_status() on the charm singleton after all the reactive handlers have run. If no handler calls the assess_status() method then the _assess_status() 'real' method won't be called for that hook invocation. Change-Id: I5d405446761a646585dfa1c446009e4374c01000
68 KiB
68 KiB