Copy the list of active skills during operations

A skill can be missed if a skill is removed (due to an error) from the
list during iteration
pull/2503/head
Åke Forslund 2020-03-15 19:11:01 +01:00
parent eee3e7aac2
commit 8e61019451
1 changed files with 2 additions and 1 deletions

View File

@ -234,6 +234,7 @@ class IntentService:
return result.data.get('result', False)
def handle_converse_error(self, message):
LOG.error(message.data['error'])
skill_id = message.data["skill_id"]
if message.data["error"] == "skill id does not exist":
self.remove_active_skill(skill_id)
@ -401,7 +402,7 @@ class IntentService:
1] <= self.converse_timeout * 60]
# check if any skill wants to handle utterance
for skill in self.active_skills:
for skill in copy(self.active_skills):
if self.do_converse(utterances, skill[0], lang, message):
# update timestamp, or there will be a timeout where
# intent stops conversing whether its being used or not