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
@@ -11,3 +11,6 @@ Every service imports only what it needs to start. `make check` runs `scripts/ch
|
||||
- Package `__init__` files don't re-export clients or SDKs.
|
||||
- An SDK used by one function is imported inside it. On an async path load it first with `await preload("<module>")` from `utils.imports`, so the event loop never waits on the import.
|
||||
- Types used in Dishka provider signatures and `FromDishka[...]` stay real top-level imports.
|
||||
|
||||
## Dynamic config
|
||||
`config()` returns a copy of an in-process snapshot: no database round-trip per call, changes from any process show up within 5 s through a version number on the config record. Never `save()` a config you read; write through `DynamicConfig.update_config(section=...)` (Mongo) or `ConfigRepository.update(section=...)`/`save(...)` (Postgres), which bump the version atomically. Counters and other hot data don't belong in the config, give them their own collection or table with atomic increments.
|
||||
Reference in new issue
Block a user