From 11a64a4be7b47e3a4106e34ba8b205ed2340b6b2 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 14 Aug 2026 19:27:46 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Replace=20blocking=20I/O=20with=20a?= =?UTF-8?q?sync=20I/O=20in=20backup=20task?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `ConfigurationBackup` class previously used `open(settings_file, 'w')` inside an asynchronous function `execute_backup`, causing the main event loop to block. This commit refactors the code to use `aiofiles.open()` in an async context, which allows the event loop to continue processing while configuration settings are written to disk. Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com> --- archive/v1/src/tasks/backup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/archive/v1/src/tasks/backup.py b/archive/v1/src/tasks/backup.py index ff48d0e896..6d9ea609d9 100644 --- a/archive/v1/src/tasks/backup.py +++ b/archive/v1/src/tasks/backup.py @@ -8,6 +8,7 @@ import shutil import gzip import json +import aiofiles from datetime import datetime, timedelta from pathlib import Path from typing import Dict, Any, Optional, List @@ -240,8 +241,8 @@ async def execute_backup(self, session: AsyncSession) -> Dict[str, Any]: } settings_file = temp_dir / "settings_dump.json" - with open(settings_file, 'w') as f: - json.dump(settings_dump, f, indent=2) + async with aiofiles.open(settings_file, 'w') as f: + await f.write(json.dumps(settings_dump, indent=2)) # Create tar.gz archive tar_cmd = [