Added comments to document race condition
parent
2deab67021
commit
18cb28088d
|
@ -411,7 +411,16 @@ class MycroftSkill:
|
|||
return False
|
||||
|
||||
def __get_response(self):
|
||||
"""Helper to get a reponse from the user
|
||||
"""Helper to get a response from the user
|
||||
|
||||
NOTE: There is a race condition here. There is a small amount of
|
||||
time between the end of the device speaking and the converse method
|
||||
being overridden in this method. If an utterance is injected during
|
||||
this time, the wrong converse method is executed. The condition is
|
||||
hidden during normal use due to the amount of time it takes a user
|
||||
to speak a response. The condition is revealed when an automated
|
||||
process injects an utterance quicker than this method can flip the
|
||||
converse methods.
|
||||
|
||||
Returns:
|
||||
str: user's response or None on a timeout
|
||||
|
|
|
@ -235,6 +235,12 @@ def then_contains(context, text):
|
|||
@then('the user replies "{text}"')
|
||||
@then('the user says "{text}"')
|
||||
def then_user_follow_up(context, text):
|
||||
"""Send a user response after being prompted by device.
|
||||
|
||||
The sleep after the device is finished speaking is to address a race
|
||||
condition in the MycroftSkill base class conversational code. It can
|
||||
be removed when the race condition is addressed.
|
||||
"""
|
||||
wait_while_speaking()
|
||||
time.sleep(2)
|
||||
context.bus.emit(Message('recognizer_loop:utterance',
|
||||
|
|
Loading…
Reference in New Issue