Make config file reloading work again
This commit is contained in:
parent
eb11e7a13a
commit
05b248e31a
1
TODO.md
1
TODO.md
|
@ -21,7 +21,6 @@
|
||||||
- Fixes
|
- Fixes
|
||||||
- Restore previous focus after closing right click context menu
|
- Restore previous focus after closing right click context menu
|
||||||
|
|
||||||
- Reloading config files (cache)
|
|
||||||
- Run import in thread and AsyncClient.olm functions, they block async loop
|
- Run import in thread and AsyncClient.olm functions, they block async loop
|
||||||
- Handle import keys errors
|
- Handle import keys errors
|
||||||
- Show error box if uploading avatar fails
|
- Show error box if uploading avatar fails
|
||||||
|
|
|
@ -22,8 +22,6 @@ class ConfigFile:
|
||||||
backend: Backend = field(repr=False)
|
backend: Backend = field(repr=False)
|
||||||
filename: str = field()
|
filename: str = field()
|
||||||
|
|
||||||
_cached_read: str = field(default="", init=False, compare=False)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def path(self) -> Path:
|
def path(self) -> Path:
|
||||||
return Path(self.backend.app.appdirs.user_config_dir) / self.filename
|
return Path(self.backend.app.appdirs.user_config_dir) / self.filename
|
||||||
|
@ -34,13 +32,8 @@ class ConfigFile:
|
||||||
|
|
||||||
|
|
||||||
async def read(self):
|
async def read(self):
|
||||||
if self._cached_read:
|
|
||||||
log.debug("Returning cached config %s", type(self).__name__)
|
|
||||||
return self._cached_read
|
|
||||||
|
|
||||||
log.debug("Reading config %s at %s", type(self).__name__, self.path)
|
log.debug("Reading config %s at %s", type(self).__name__, self.path)
|
||||||
self._cached_read = self.path.read_text()
|
return self.path.read_text()
|
||||||
return self._cached_read
|
|
||||||
|
|
||||||
|
|
||||||
async def write(self, data) -> None:
|
async def write(self, data) -> None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user