Skip to content

Commit

Permalink
Lower poll interval for blockUntilConditionMet (#14324)
Browse files Browse the repository at this point in the history
Summary of the issue:
Due to intermittent system test failures, #14284 increased the polling interval used in blockUntilConditionMet.
When writing unit tests for blockUntilConditionMet in #14301, a bug was picked up. This bug caused blockUntilConditionMet to spin for longer than expected and potentially caused system tests to fail.

This bug was fixed with a new implementation of blockUntilConditionMet.

Description of user facing changes
For devs, system tests should be faster (todo: estimate from build?)

Description of development approach
Lower default polling interval
  • Loading branch information
seanbudd committed Dec 7, 2022
1 parent 279643e commit 53723b0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions source/utils/blockUntilConditionMet.py
Expand Up @@ -19,10 +19,10 @@
EvaluatorWasMetT = bool
GetValueResultT = Any

DEFAULT_INTERVAL_BETWEEN_EVAL_SECONDS = 0.3
DEFAULT_INTERVAL_BETWEEN_EVAL_SECONDS = 0.1
"""The default interval (in seconds) between calls to the evaluator."""

_MIN_INTERVAL_BETWEEN_EVAL_SECONDS = 0.1
_MIN_INTERVAL_BETWEEN_EVAL_SECONDS = 0.01
"""The minimum interval (in seconds) between calls to the evaluator.
Small values for the interval can starve NVDA core, preventing it
from being able to process queued events.
Expand Down
Expand Up @@ -22,15 +22,16 @@
EvaluatorWasMetT = bool
GetValueResultT = Any

DEFAULT_INTERVAL_BETWEEN_EVAL_SECONDS = 0.3
DEFAULT_INTERVAL_BETWEEN_EVAL_SECONDS = 0.1
"""The default interval (in seconds) between calls to the evaluator."""

_MIN_INTERVAL_BETWEEN_EVAL_SECONDS = 0.1
_MIN_INTERVAL_BETWEEN_EVAL_SECONDS = 0.01
"""The minimum interval (in seconds) between calls to the evaluator.
Small values for the interval can starve NVDA core, preventing it
from being able to process queued events.
"""


def _blockUntilConditionMet(
getValue: Callable[[], GetValueResultT],
giveUpAfterSeconds: float,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_util/test_blockUntilConditionMet.py
Expand Up @@ -23,7 +23,7 @@ class _FakeTimer():
Patches sleeping and getting the current time,
so that the module under test is not dependent on real world time.
"""
POLL_INTERVAL = 0.2
POLL_INTERVAL = 0.1

def __init__(self) -> None:
self._fakeTime: float = 0.0
Expand Down

0 comments on commit 53723b0

Please sign in to comment.