Add temporary fix for race conditions

[MAILPOET-2436]
This commit is contained in:
Jan Jakeš
2019-10-31 14:26:50 +01:00
committed by Jack Kitterhing
parent 826ba18e14
commit d3aecc718d
2 changed files with 21 additions and 12 deletions

View File

@@ -109,7 +109,7 @@ class SettingsController {
}
}
$setting[$last_key] = $value;
$this->saveValue($main_key, $this->settings[$main_key]);
$this->settings_repository->createOrUpdateByName($main_key, $this->settings[$main_key]);
}
function delete($key) {
@@ -150,17 +150,6 @@ class SettingsController {
return $setting ? $setting->getValue() : null;
}
private function saveValue($key, $value) {
$setting = $this->settings_repository->findOneByName($key);
if (!$setting) {
$setting = new SettingEntity();
$setting->setName($key);
$this->settings_repository->persist($setting);
}
$setting->setValue($value);
$this->settings_repository->flush();
}
function resetCache() {
$this->settings = [];
$this->loaded = false;