Handle race condition between ovos.common_play.query.response
and ovos.common_play.skill.search_end
#94
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As described in #93, this commit fixes the race condition that exists between the search response events and the search end event.
It works by using a per-skill
Lock
and ensures that thehandle_skill_response
handler finishes executing before thehandle_skill_search_end
handler terminates the searching process.That fix introduces another race condition between
ovos.common_play.skill.search_start
andovos.common_play.query.response
. To workaround that race condition we lock when accessing theactive_skills
dictionary.Note that there still exists a race condition in the
handle_skill_search_end
handler that has an existing sleep hack. I left this hacky fix in place. A better fix could come later.fixes the race condition in #93. Does not attempt to fix the reason
is_gui_connected
takes a long time to return.fixes #93