diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-20 14:17:49 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-30 21:38:13 +0000 |
commit | 8c36c90afc392980d999a981a924dc7d22e2766e (patch) | |
tree | f4ccc0ccd4ae8f002804bf99b5ab6c529fe7a423 /lib/bb/server/process.py | |
parent | 2d0940b920a22b244f3ba6849c7cd019578386b4 (diff) | |
download | bitbake-8c36c90afc392980d999a981a924dc7d22e2766e.tar.gz |
event: Add enable/disable heartbeat code
Currently heartbeat events are always generated by the server whilst it is
active. Change this so they only appear when builds are running, which is
when most code would expect to be executed. This removes a number of races
around changes in the datastore which can happen outside of builds.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/server/process.py')
-rw-r--r-- | lib/bb/server/process.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py index 586d46af8..91eb6e0ad 100644 --- a/lib/bb/server/process.py +++ b/lib/bb/server/process.py @@ -382,7 +382,7 @@ class ProcessServer(): # Create new heartbeat event? now = time.time() - if now >= self.next_heartbeat: + if bb.event._heartbeat_enabled and now >= self.next_heartbeat: # We might have missed heartbeats. Just trigger once in # that case and continue after the usual delay. self.next_heartbeat += self.heartbeat_seconds @@ -396,7 +396,7 @@ class ProcessServer(): if not isinstance(exc, bb.BBHandledException): logger.exception('Running heartbeat function') self.quit = True - if nextsleep and now + nextsleep > self.next_heartbeat: + if nextsleep and bb.event._heartbeat_enabled and now + nextsleep > self.next_heartbeat: # Shorten timeout so that we we wake up in time for # the heartbeat. nextsleep = self.next_heartbeat - now |