Skip to content
Snippets Groups Projects
Commit f4bfd281 authored by Erik Reid's avatar Erik Reid
Browse files

POL1-492: erase sensu cache before each update

parent 8715123d
Branches
Tags
No related merge requests found
...@@ -29,8 +29,8 @@ import click ...@@ -29,8 +29,8 @@ import click
import jsonschema import jsonschema
from statsd import StatsClient from statsd import StatsClient
from brian_polling_manager \ from brian_polling_manager import inventory, configuration, \
import inventory, configuration, interfaces, gws_direct, gws_indirect interfaces, gws_direct, gws_indirect, sensu
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -74,6 +74,8 @@ def refresh(config, force=False): ...@@ -74,6 +74,8 @@ def refresh(config, force=False):
:param force: if True, reload inventory data even if timestamp is same :param force: if True, reload inventory data even if timestamp is same
:return: a dict, formatted as above :return: a dict, formatted as above
""" """
sensu.clear_cached_values()
state = configuration.State(config['statedir']) state = configuration.State(config['statedir'])
last = inventory.last_update_timestamp(config['inventory']) last = inventory.last_update_timestamp(config['inventory'])
if force or not last or last != state.last: if force or not last or last != state.last:
......
...@@ -12,6 +12,11 @@ logger = logging.getLogger(__name__) ...@@ -12,6 +12,11 @@ logger = logging.getLogger(__name__)
_cached_checks = None # not using lru_cache, since params is a dict _cached_checks = None # not using lru_cache, since params is a dict
def clear_cached_values():
global _cached_checks
_cached_checks = None
def load_all_checks(params, namespace='default'): def load_all_checks(params, namespace='default'):
global _cached_checks global _cached_checks
if _cached_checks is not None: if _cached_checks is not None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment