diff options
author | James E. Blair <jim@acmegating.com> | 2021-09-06 15:51:16 -0700 |
---|---|---|
committer | James E. Blair <jim@acmegating.com> | 2021-09-10 10:55:00 -0700 |
commit | 65cac91e6cdcc93d445c18db39d3471ede3f587d (patch) | |
tree | c4d214ad3860a2dd01b6403b1b05d7c7b98345e8 /zuul/nodepool.py | |
parent | aee6ef6f7f93c3c1dccd0576165d71ac1eecd13e (diff) | |
download | zuul-65cac91e6cdcc93d445c18db39d3471ede3f587d.tar.gz |
Add ZK session-aware elections
This creates a session-aware election class which will set a flag
that indicates it has lost the underlying lock. We can check this
flag when iterating to make sure that we don't continue to attempt
to operate when we have lost the lock underlying an election.
Some drivers had connection lost handling for the EventReceiverElection
at the driver level. Those are updated to use the handling at the
election level for consistency as well as brevity.
Change-Id: I776f88d015acdfbf1487a85d8473cd174917e90f
Diffstat (limited to 'zuul/nodepool.py')
-rw-r--r-- | zuul/nodepool.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/zuul/nodepool.py b/zuul/nodepool.py index 86ceaa51f..689c55bd7 100644 --- a/zuul/nodepool.py +++ b/zuul/nodepool.py @@ -121,8 +121,11 @@ class Nodepool(object): # completed event is added to the zk queue. try: if self.election_won: - self.emitStats(request) - self._sendNodesProvisionedEvent(request) + if self.election.is_still_valid(): + self.emitStats(request) + self._sendNodesProvisionedEvent(request) + else: + self.stop_watcher_event.set() except Exception: # If there are any errors moving the event, re-run the # election. |