Esempio n. 1
0
def get_raw_configs():
    try:
        all_configs = rds.hgetall(config_hash)
        return {k.decode('utf-8'): numeric(v.decode('utf-8')) for k, v in six.iteritems(all_configs) if v is not None}
    except Exception as ex:
        logger.exception(ex)
        return {}
Esempio n. 2
0
def get_raw_configs() -> Mapping[str, Optional[Any]]:
    try:
        all_configs = rds.hgetall(config_hash)
        return {
            k.decode('utf-8'): numeric(v.decode('utf-8'))
            for k, v in all_configs.items() if v is not None
        }
    except Exception as ex:
        logger.exception(ex)
        return {}
Esempio n. 3
0
 def _load_state(self) -> Sequence[Tuple[int, int]]:
     """
     Retrieves saved state from Redis and returns a sorted timeseries
     of hits
     """
     hit_data = redis_client.hgetall(self.__name)
     state = [(int(timestamp), int(hits))
              for (timestamp, hits) in hit_data.items()]
     state.sort(key=lambda entry: entry[0])
     return state