Update pickledb.py

Commit 7e09904 · Harrison Erd · 2025-02-11T23:46:32-05:00

Changeset
7e09904a8ab68a621d8a52438c9dc694cb12cb15
Parents
50d2242ed7873ae87f57ef0f8829379b97998ef8

View source at this commit

Comments

No comments yet.

Log in to comment

Diff

diff --git a/pickledb.py b/pickledb.py
index 83a7195..e483e95 100644
--- a/pickledb.py
+++ b/pickledb.py
@@ -270,7 +270,7 @@ class AsyncPickleDB(PickleDB):
             try:
                 async with aiofiles.open(temp_location, "wb") as temp_file:
                     await temp_file.write(orjson.dumps(self.db))
-                os.replace(temp_location, self.location)
+            await asyncio.to_thread(os.replace, temp_location, self.location)
                 return True
             except Exception as e:
                 print(f"Failed to save database: {e}")