Fix a race condition when creating config.key_to_id

This commit is contained in:
Oskar Hahn 2019-03-09 18:55:58 +01:00
parent fc7a3a7f51
commit 8409378e00

View File

@ -68,9 +68,9 @@ class ConfigHandler:
This uses the element_cache. It expects, that the config values are in the database
before this is called.
"""
self.key_to_id = {}
all_data = await element_cache.get_all_full_data()
elements = all_data[self.get_collection_string()]
self.key_to_id = {}
for element in elements:
self.key_to_id[element["key"]] = element["id"]