-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle multiple intents with the same name (#2921) #235
Conversation
* Add check for duplicate adapt intents There are two cases, duplicated named intent and duplicated anonymous intent. A named intent will cause a ValueError exception notifying the skill author that there is a collision. An anonymous intent will silently derive a new name and use that instead of the default generated one. * Add tests for intent collisions * Make enable/disable intent handle the new exception The enable/disable intent did not mark an intent as detached, instead it remained in the list of intents after disabling in the IntentServiceInterface to be retrieved when the intent should be re-enabled. This moves detached intents into a list of detached intents to so they won't cause the double enable exception. * Add move logic to find if intent is detached MycroftSkill.enable_intent() will now check if the intent is detached before trying to re-enable it. * Lock updates of intents This should avoid some race conditions that may occur if multiple threads tries to enable / disable intents
Codecov Report
@@ Coverage Diff @@
## dev #235 +/- ##
==========================================
+ Coverage 50.35% 54.90% +4.55%
==========================================
Files 119 156 +37
Lines 10077 9350 -727
==========================================
+ Hits 5074 5134 +60
+ Misses 5003 4216 -787
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
969ed81
to
6302211
Compare
789c711
to
1f8f074
Compare
@@ -21,7 +21,7 @@ | |||
from inspect import signature | |||
from itertools import chain | |||
from os.path import join, abspath, dirname, basename, exists, isfile | |||
from threading import Event | |||
from threading import Event, Lock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've started using RLock
for applications like these in case different wrappers are added/refactored; so long as only one thread is mutating things at a time, we should be okay
closes #233