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-31 17:05:17 +0000 |
commit | cb8efd4d20d7643632b04ce8350c1b58aed49122 (patch) | |
tree | 6b8bbc5edf3e53fcb148b12a60861d7237356d9d /bitbake/lib/bb/server | |
parent | 2c5bc0379675c11a84056b2ac5ccaad766c3e766 (diff) | |
download | poky-cb8efd4d20d7643632b04ce8350c1b58aed49122.tar.gz |
bitbake: 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.
(Bitbake rev: 8c36c90afc392980d999a981a924dc7d22e2766e)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/server')
-rw-r--r-- | bitbake/lib/bb/server/process.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 586d46af88..91eb6e0ad9 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
@@ -382,7 +382,7 @@ class ProcessServer(): | |||
382 | 382 | ||
383 | # Create new heartbeat event? | 383 | # Create new heartbeat event? |
384 | now = time.time() | 384 | now = time.time() |
385 | if now >= self.next_heartbeat: | 385 | if bb.event._heartbeat_enabled and now >= self.next_heartbeat: |
386 | # We might have missed heartbeats. Just trigger once in | 386 | # We might have missed heartbeats. Just trigger once in |
387 | # that case and continue after the usual delay. | 387 | # that case and continue after the usual delay. |
388 | self.next_heartbeat += self.heartbeat_seconds | 388 | self.next_heartbeat += self.heartbeat_seconds |
@@ -396,7 +396,7 @@ class ProcessServer(): | |||
396 | if not isinstance(exc, bb.BBHandledException): | 396 | if not isinstance(exc, bb.BBHandledException): |
397 | logger.exception('Running heartbeat function') | 397 | logger.exception('Running heartbeat function') |
398 | self.quit = True | 398 | self.quit = True |
399 | if nextsleep and now + nextsleep > self.next_heartbeat: | 399 | if nextsleep and bb.event._heartbeat_enabled and now + nextsleep > self.next_heartbeat: |
400 | # Shorten timeout so that we we wake up in time for | 400 | # Shorten timeout so that we we wake up in time for |
401 | # the heartbeat. | 401 | # the heartbeat. |
402 | nextsleep = self.next_heartbeat - now | 402 | nextsleep = self.next_heartbeat - now |