2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

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.
This commit is contained in:
Jarrod Johnson 2014-05-29 10:53:32 -04:00
parent a7398198d4
commit 68c7e5b77e

View File

@ -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: {}}