diff options
Diffstat (limited to 'bitbake/lib/bb/server/process.py')
| -rw-r--r-- | bitbake/lib/bb/server/process.py | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index a25f04d148..529196b78c 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
| @@ -439,6 +439,28 @@ class ProcessServer(): | |||
| 439 | serverlog("Exception %s broke the idle_thread, exiting" % traceback.format_exc()) | 439 | serverlog("Exception %s broke the idle_thread, exiting" % traceback.format_exc()) |
| 440 | self.quit = True | 440 | self.quit = True |
| 441 | 441 | ||
| 442 | # Create new heartbeat event? | ||
| 443 | now = time.time() | ||
| 444 | if bb.event._heartbeat_enabled and now >= self.next_heartbeat: | ||
| 445 | # We might have missed heartbeats. Just trigger once in | ||
| 446 | # that case and continue after the usual delay. | ||
| 447 | self.next_heartbeat += self.heartbeat_seconds | ||
| 448 | if self.next_heartbeat <= now: | ||
| 449 | self.next_heartbeat = now + self.heartbeat_seconds | ||
| 450 | if hasattr(self.cooker, "data"): | ||
| 451 | heartbeat = bb.event.HeartbeatEvent(now) | ||
| 452 | try: | ||
| 453 | bb.event.fire(heartbeat, self.cooker.data) | ||
| 454 | except Exception as exc: | ||
| 455 | if not isinstance(exc, bb.BBHandledException): | ||
| 456 | logger.exception('Running heartbeat function') | ||
| 457 | serverlog("Exception %s broke in idle_thread, exiting" % traceback.format_exc()) | ||
| 458 | self.quit = True | ||
| 459 | if nextsleep and bb.event._heartbeat_enabled and now + nextsleep > self.next_heartbeat: | ||
| 460 | # Shorten timeout so that we we wake up in time for | ||
| 461 | # the heartbeat. | ||
| 462 | nextsleep = self.next_heartbeat - now | ||
| 463 | |||
| 442 | if nextsleep is not None: | 464 | if nextsleep is not None: |
| 443 | select.select(fds,[],[],nextsleep)[0] | 465 | select.select(fds,[],[],nextsleep)[0] |
| 444 | 466 | ||
| @@ -451,28 +473,6 @@ class ProcessServer(): | |||
| 451 | self.idle = threading.Thread(target=self.idle_thread) | 473 | self.idle = threading.Thread(target=self.idle_thread) |
| 452 | self.idle.start() | 474 | self.idle.start() |
| 453 | 475 | ||
| 454 | # Create new heartbeat event? | ||
| 455 | now = time.time() | ||
| 456 | if bb.event._heartbeat_enabled and now >= self.next_heartbeat: | ||
| 457 | # We might have missed heartbeats. Just trigger once in | ||
| 458 | # that case and continue after the usual delay. | ||
| 459 | self.next_heartbeat += self.heartbeat_seconds | ||
| 460 | if self.next_heartbeat <= now: | ||
| 461 | self.next_heartbeat = now + self.heartbeat_seconds | ||
| 462 | if hasattr(self.cooker, "data"): | ||
| 463 | heartbeat = bb.event.HeartbeatEvent(now) | ||
| 464 | try: | ||
| 465 | bb.event.fire(heartbeat, self.cooker.data) | ||
| 466 | except Exception as exc: | ||
| 467 | if not isinstance(exc, bb.BBHandledException): | ||
| 468 | logger.exception('Running heartbeat function') | ||
| 469 | serverlog("Exception %s broke in idle_commands, exiting" % traceback.format_exc()) | ||
| 470 | self.quit = True | ||
| 471 | if nextsleep and bb.event._heartbeat_enabled and now + nextsleep > self.next_heartbeat: | ||
| 472 | # Shorten timeout so that we we wake up in time for | ||
| 473 | # the heartbeat. | ||
| 474 | nextsleep = self.next_heartbeat - now | ||
| 475 | |||
| 476 | if nextsleep is not None: | 476 | if nextsleep is not None: |
| 477 | if self.xmlrpc: | 477 | if self.xmlrpc: |
| 478 | nextsleep = self.xmlrpc.get_timeout(nextsleep) | 478 | nextsleep = self.xmlrpc.get_timeout(nextsleep) |
