mirror of
https://github.com/ansible/ansible.git
synced 2026-08-03 08:03:05 +02:00
Fix pause CPU consumption (#81519)
* Sleep for the DEFAULT_INTERNAL_POLL_INTERVAL between polling for user input Fixes #81516
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- Prompting - add a short sleep between polling for user input to reduce CPU consumption (https://github.com/ansible/ansible/issues/81516).
|
||||
@@ -708,6 +708,8 @@ class Display(metaclass=Singleton):
|
||||
os.set_blocking(self._stdin_fd, False)
|
||||
while key_pressed is None and (seconds is None or (time.time() - start < seconds)):
|
||||
key_pressed = self._stdin.read(1)
|
||||
# throttle to prevent excess CPU consumption
|
||||
time.sleep(C.DEFAULT_INTERNAL_POLL_INTERVAL)
|
||||
finally:
|
||||
os.set_blocking(self._stdin_fd, True)
|
||||
if key_pressed is None:
|
||||
|
||||
Reference in New Issue
Block a user