Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def loop(self):
if self.config.cache == 'redis':
cache = Redis(ip=self.config.redis['ip'],
port=self.config.redis['port'],
socket=self.config.redis.socket,
del_after_read=self.config.redis['del_after_read'],
flush=self.config.redis['start_flush'],
retention=self.config.redis.retention_time if 'retention_time' in self.config.redis else None)
elif self.config.cache == 'kafka':
cache = Kafka(self.config.kafka['ip'],
self.config.kafka['port'],
flush=self.config.kafka['start_flush'])
interval = self.config.storage_interval
time_partition = False
multiplier = 1
if not isinstance(interval, int):
if len(interval) > 1:
multiplier = int(interval[:-1])
interval = interval[-1]
base_interval = interval
if interval in {'M', 'H', 'D'}:
time_partition = True
if interval == 'M':
interval = 60 * multiplier
elif interval == 'H':