Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def sync_get_version(self, name, config):
def get_version_callback(name, version):
self.stop(version)
if isinstance(config, dict):
_config = configparser.ConfigParser(dict_type=dict, allow_no_value=True)
_config.read_dict({name: config})
config = _config[name]
get_version(name, config, get_version_callback)
return self.wait()
async def worker(name, conf):
await token_q.get()
try:
for i in range(tries):
try:
ret = await get_version(
name, conf, keyman=self.keymanager)
return name, ret
except Exception as e:
if i + 1 < tries:
logger.warning('failed, retrying',
name=name, exc_info=e)
await asyncio.sleep(i)
else:
return name, e
finally:
await token_q.put(True)