Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix!: manager track prev executed directives, prevent duplicate runs
`directives` are supposed to only be executed _once_ IFF the file has been executed within the last 24h. The existing code would, during the course of the normal scheduled runs, attempt to reload and run all valid directives found in the inventory. Because we are not tracking directives that have already been executed, this means that if a directive is added to an inventory, then during the course of it's normal scheduled runs, _each run_ of the reload-and-run-all code would attempt to execute the directive during that 24h validity period. This means that a directive would not be executed once as intended, but rather would be executed `24h / $inventory.reload_interval` number of times. This adds a cache map to the manager to keep track of which directives have already been executed. NOTE: the cache is not persistent beyond the lifetime of the process in which mango is running. This means that if a new directive is added and executed by mango, and then mango itself subsequently gets restarted during the 24h validity period of that directive, the cache will be reset and mango will re-execute the directive. Given that mango is intended to be run as a long lived daemon, I find this reasonable.
- Loading branch information