Merge pull request #4488 from ostcar/fix_config_key_to_id

Fix a race condition when creating config.key_to_id
This commit is contained in:
Emanuel Schütze 2019-03-09 21:27:24 +01:00 committed by GitHub
commit 023eb54773
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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"]