Attempt to fix rare crash writing configuration
This commit is contained in:
parent
54dfd900ca
commit
58678bfe9d
@ -16,6 +16,11 @@ Json Configuration::currentConfiguration() const {
|
|||||||
return m_currentConfig;
|
return m_currentConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String Configuration::printConfiguration() const {
|
||||||
|
MutexLocker locker(m_mutex);
|
||||||
|
return m_currentConfig.printJson(2, true);
|
||||||
|
}
|
||||||
|
|
||||||
Json Configuration::get(String const& key) const {
|
Json Configuration::get(String const& key) const {
|
||||||
MutexLocker locker(m_mutex);
|
MutexLocker locker(m_mutex);
|
||||||
return m_currentConfig.get(key, {});
|
return m_currentConfig.get(key, {});
|
||||||
|
@ -17,6 +17,7 @@ public:
|
|||||||
|
|
||||||
Json defaultConfiguration() const;
|
Json defaultConfiguration() const;
|
||||||
Json currentConfiguration() const;
|
Json currentConfiguration() const;
|
||||||
|
String printConfiguration() const;
|
||||||
|
|
||||||
Json get(String const& key) const;
|
Json get(String const& key) const;
|
||||||
Json getPath(String const& path) const;
|
Json getPath(String const& path) const;
|
||||||
|
@ -678,7 +678,7 @@ void Root::writeConfig() {
|
|||||||
if (m_lastRuntimeConfig != currentConfig) {
|
if (m_lastRuntimeConfig != currentConfig) {
|
||||||
if (m_runtimeConfigFile) {
|
if (m_runtimeConfigFile) {
|
||||||
Logger::info("Root: Writing runtime configuration to '{}'", *m_runtimeConfigFile);
|
Logger::info("Root: Writing runtime configuration to '{}'", *m_runtimeConfigFile);
|
||||||
File::overwriteFileWithRename(currentConfig.printJson(2, true), *m_runtimeConfigFile);
|
File::overwriteFileWithRename(m_configuration->printConfiguration(), *m_runtimeConfigFile);
|
||||||
}
|
}
|
||||||
m_lastRuntimeConfig = currentConfig;
|
m_lastRuntimeConfig = currentConfig;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user