diff options
Diffstat (limited to 'bitbake/lib/bb/server/process.py')
-rw-r--r-- | bitbake/lib/bb/server/process.py | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 76b189291d..4b35be62cd 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
@@ -321,7 +321,22 @@ class ProcessServer(): | |||
321 | bb.warn('Ignoring invalid BB_SERVER_TIMEOUT=%s, must be a float specifying seconds.' % self.timeout) | 321 | bb.warn('Ignoring invalid BB_SERVER_TIMEOUT=%s, must be a float specifying seconds.' % self.timeout) |
322 | seendata = True | 322 | seendata = True |
323 | 323 | ||
324 | ready = self.idle_commands(.1, fds) | 324 | if not self.idle: |
325 | self.idle = threading.Thread(target=self.idle_thread) | ||
326 | self.idle.start() | ||
327 | elif self.idle and not self.idle.is_alive(): | ||
328 | serverlog("Idle thread terminated, main thread exiting too") | ||
329 | bb.error("Idle thread terminated, main thread exiting too") | ||
330 | self.quit = True | ||
331 | |||
332 | nextsleep = 1.0 | ||
333 | if self.xmlrpc: | ||
334 | nextsleep = self.xmlrpc.get_timeout(nextsleep) | ||
335 | try: | ||
336 | ready = select.select(fds,[],[],nextsleep)[0] | ||
337 | except InterruptedError: | ||
338 | # Ignore EINTR | ||
339 | ready = [] | ||
325 | 340 | ||
326 | if self.idle: | 341 | if self.idle: |
327 | self.idle.join() | 342 | self.idle.join() |
@@ -424,7 +439,7 @@ class ProcessServer(): | |||
424 | self.idle_cond.notify_all() | 439 | self.idle_cond.notify_all() |
425 | 440 | ||
426 | while not self.quit: | 441 | while not self.quit: |
427 | nextsleep = 0.1 | 442 | nextsleep = 1.0 |
428 | fds = [] | 443 | fds = [] |
429 | 444 | ||
430 | with bb.utils.lock_timeout(self._idlefuncsLock): | 445 | with bb.utils.lock_timeout(self._idlefuncsLock): |
@@ -462,7 +477,7 @@ class ProcessServer(): | |||
462 | 477 | ||
463 | # Create new heartbeat event? | 478 | # Create new heartbeat event? |
464 | now = time.time() | 479 | now = time.time() |
465 | if bb.event._heartbeat_enabled and now >= self.next_heartbeat: | 480 | if items and bb.event._heartbeat_enabled and now >= self.next_heartbeat: |
466 | # We might have missed heartbeats. Just trigger once in | 481 | # We might have missed heartbeats. Just trigger once in |
467 | # that case and continue after the usual delay. | 482 | # that case and continue after the usual delay. |
468 | self.next_heartbeat += self.heartbeat_seconds | 483 | self.next_heartbeat += self.heartbeat_seconds |
@@ -485,31 +500,6 @@ class ProcessServer(): | |||
485 | if nextsleep is not None: | 500 | if nextsleep is not None: |
486 | select.select(fds,[],[],nextsleep)[0] | 501 | select.select(fds,[],[],nextsleep)[0] |
487 | 502 | ||
488 | def idle_commands(self, delay, fds=None): | ||
489 | nextsleep = delay | ||
490 | if not fds: | ||
491 | fds = [] | ||
492 | |||
493 | if not self.idle: | ||
494 | self.idle = threading.Thread(target=self.idle_thread) | ||
495 | self.idle.start() | ||
496 | elif self.idle and not self.idle.is_alive(): | ||
497 | serverlog("Idle thread terminated, main thread exiting too") | ||
498 | bb.error("Idle thread terminated, main thread exiting too") | ||
499 | self.quit = True | ||
500 | |||
501 | if nextsleep is not None: | ||
502 | if self.xmlrpc: | ||
503 | nextsleep = self.xmlrpc.get_timeout(nextsleep) | ||
504 | try: | ||
505 | return select.select(fds,[],[],nextsleep)[0] | ||
506 | except InterruptedError: | ||
507 | # Ignore EINTR | ||
508 | return [] | ||
509 | else: | ||
510 | return select.select(fds,[],[],0)[0] | ||
511 | |||
512 | |||
513 | class ServerCommunicator(): | 503 | class ServerCommunicator(): |
514 | def __init__(self, connection, recv): | 504 | def __init__(self, connection, recv): |
515 | self.connection = connection | 505 | self.connection = connection |