feat(config): served from an in-process cache with a 5 s version check, writes bump the version atomically, mongo and postgres alike, redis keyed by version on top
This commit is contained in:
1 parent
4cb3b85321
commit
eed732fbcf
4 files changed
+200
-81
No files matched your search
+3
-4
@@ -261,10 +261,9 @@ async def read_config() -> DynamicConfigBase:
|
||||
|
||||
async def write_config(config: DynamicConfigBase) -> DynamicConfigBase:
|
||||
await init_db()
|
||||
doc = await DynamicConfig.get_or_create()
|
||||
for name in DynamicConfigBase.model_fields:
|
||||
setattr(doc, name, getattr(config, name))
|
||||
await doc.save()
|
||||
await DynamicConfig.update_config(
|
||||
**{name: getattr(config, name) for name in DynamicConfigBase.model_fields}
|
||||
)
|
||||
return config
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user