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
refactor/improve_config #105
Conversation
b09e147
to
9ea4715
Compare
|
so many tests to rewrite and refactor all the config mocking.... |
26fd786
to
239d689
Compare
|
Does this mean that the config files will be read each time a value is fetched from the config? |
|
If that is the case perhaps a file cache can be added and the watchdog module can be leveraged to trigger updates of the cache similar to this: forslund/skill-configuration@b558a86 ? |
this is not the intention, disk reads should only happen when .reload is called explicitly and on first init. The aim is that they are read exactly once unless changed note that the load stack method only assembles the final merged dict, the configs are still singletons |
i like this filewatcher, maybe that can be unified in this new class, that allows TTS/STT to drop their config hash comparison loops |
|
I would probably leave the hash in there since we'd only want to reload if the STT/TTS section of the the config changed. But this is quite useful to make sure changes on disk is reflected in the live config without the need for polling |
the hash itself is not the issue, just mean the loop to check that hash can become event based if we use that file watcher. I'm thinking about either adding new dedicated events for stt/tts or just listening to the regular configuration.updated and do the hash check on that event |
Right, that makes a lot of sense. Just make sure to add a lock if you reload the module out-of-line |
239d689
to
9ff8958
Compare
e003604
to
5956209
Compare
|
@forslund i rebased this PR and implemented your FileWatcher class suggestion I did some refactoring to keep the old class name and increase compatibility, if you feel up to it a new set of eyes would be appreciated :) for some reason one of the unittests is now failing but i cant figure out why yet.... doesnt seem related to this change, i guess i missed some mock? |
fix cyclic imports fix more unittest mocks fix typo update unittest mocks revert unrelated change keep old class name update mocks fix imports deprecated config class dict events new config class
a4714f0
to
edd8e99
Compare
edd8e99
to
31aafcf
Compare
Codecov Report
@@ Coverage Diff @@
## dev #105 +/- ##
==========================================
+ Coverage 50.35% 52.70% +2.35%
==========================================
Files 119 150 +31
Lines 10077 9336 -741
==========================================
- Hits 5074 4921 -153
+ Misses 5003 4415 -588
Continue to review full report at Codecov.
|
|
Nice to have the file watcher included! |
replaces #13