From 68c7e5b77e4bd393fb644d28db6c2fcad566c39f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 29 May 2014 10:53:32 -0400 Subject: [PATCH] Improve performance of creating new configmanager objects Previously, the null tenant always synced to disk on every request in pracitice. Correct that mistake to avoid commit to disk when no changes are being made. --- confluent_server/confluent/config/configmanager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/config/configmanager.py b/confluent_server/confluent/config/configmanager.py index c20e65ef..e486425b 100644 --- a/confluent_server/confluent/config/configmanager.py +++ b/confluent_server/confluent/config/configmanager.py @@ -414,12 +414,14 @@ class ConfigManager(object): self.tenant = None if 'main' not in _cfgstore: _cfgstore['main'] = {} + self._bg_sync_to_file() self._cfgstore = _cfgstore['main'] if 'groups' not in self._cfgstore: self._cfgstore['groups'] = {'everything': {'nodes': set()}} + self._bg_sync_to_file() if 'nodes' not in self._cfgstore: self._cfgstore['nodes'] = {} - self._bg_sync_to_file() + self._bg_sync_to_file() return elif 'tenant' not in _cfgstore: _cfgstore['tenant'] = {tenant: {}}