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 create_znode(self, path):
try:
await self.client.create(path)
except exc.NodeExists:
pass
except exc.NoNode:
try:
await self.ensure_path()
except exc.NodeExists:
pass
async def create_znode(self, path):
try:
await self.client.create(path)
except exc.NodeExists:
pass
except exc.NoNode:
try:
await self.ensure_path()
except exc.NodeExists:
pass
async def apply_operation(self, operation):
success = False
while not success:
new_value = operation(self.value)
data = str(new_value)
try:
stat = await self.client.set(self.base_path, data, self._version)
log.debug("Operation '%s': successful", operation.__name__)
self.value = new_value
self._version = stat.version
success = True
except exc.BadVersion:
await self._fetch()
log.debug(
"Operation '%s': version mismatch, retrying",
operation.__name__
)