diff options
author | Felix Edel <felix.edel@bmw.de> | 2021-11-05 09:48:52 +0100 |
---|---|---|
committer | Simon Westphahl <simon.westphahl@bmw.de> | 2021-11-09 09:17:43 +0100 |
commit | 2c900c2c4a3ab65c31c5cba3c379f6675c4169d9 (patch) | |
tree | e7d4c3d610e6da95447241472d60bbbe0d6692a6 /zuul/driver/git | |
parent | 783990597237a480b726635e051c625e810d732f (diff) | |
download | zuul-2c900c2c4a3ab65c31c5cba3c379f6675c4169d9.tar.gz |
Split up registerScheduler() and onLoad() methods
This is an early preparation step for removing the RPC calls between
zuul-web and the scheduler.
In order to do so we must initialize the ConfigLoader in zuul-web which
requires all connections to be available. Therefore, this change ensures
that we can load all connections in zuul-web without providing a
scheduler instance.
To avoid unnecessary traffic from a zuul-web instance the onLoad()
method initializes the change cache only if a scheduler instance is
available on the connection.
Change-Id: I3c1d2995e81e17763ae3454076ab2f5ce87ab1fc
Diffstat (limited to 'zuul/driver/git')
-rw-r--r-- | zuul/driver/git/gitconnection.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/zuul/driver/git/gitconnection.py b/zuul/driver/git/gitconnection.py index 6346f676b..8e52e798f 100644 --- a/zuul/driver/git/gitconnection.py +++ b/zuul/driver/git/gitconnection.py @@ -165,9 +165,15 @@ class GitConnection(ZKChangeCacheMixin, BaseConnection): # Pass the event to the scheduler self.sched.addTriggerEvent(self.driver_name, event) - def onLoad(self): + def onLoad(self, zk_client): self.log.debug("Creating Zookeeper change cache") - self._change_cache = GitChangeCache(self.sched.zk_client, self) + self._change_cache = GitChangeCache(zk_client, self) + + # If the connection was not loaded by a scheduler, but by e.g. + # zuul-web, we want to stop here. + if not self.sched: + return + self.log.debug("Starting Git Watcher") self._start_watcher_thread() |