From 9c92b9bf8f763ea819e6538712177a40611af36b Mon Sep 17 00:00:00 2001 From: Ivan Filipenkov Date: Mon, 6 May 2024 21:59:15 +0200 Subject: [PATCH] fix: config is no longer erased when it fails to save. Also, the config is saved synchronously now --- tgpy/api/config.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tgpy/api/config.py b/tgpy/api/config.py index 6b660bf..9b6dbc4 100644 --- a/tgpy/api/config.py +++ b/tgpy/api/config.py @@ -49,12 +49,8 @@ def load(self): except FileNotFoundError: self.__data = {} - def _save(self): - with open(CONFIG_FILENAME, 'w') as file: - yaml.safe_dump(self.__data, file) - def save(self): - Thread(target=self._save).start() + CONFIG_FILENAME.write_text(yaml.safe_dump(self.__data)) config = Config()