Skip to content

Commit

Permalink
Guarantee the self-deletion from a peering object if operator is exiting
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Vasilyev committed Jul 5, 2019
1 parent ea47277 commit 4e0cd0a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kopf/engines/peering.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,12 @@ async def peers_keepalive(
await asyncio.sleep(max(1, int(ourselves.lifetime.total_seconds() - 10)))
finally:
try:
await ourselves.disappear()
except:
await asyncio.shield(ourselves.disappear())
except asyncio.CancelledError:
# It is the cancellation of `keepalive()`, not of the shielded `disappear()`.
pass
except Exception:
logger.exception(f"Couldn't remove self from the peering. Ignoring.")


def detect_own_id() -> str:
Expand Down

0 comments on commit 4e0cd0a

Please sign in to comment.