Skip to content

Commit 34f53dc

Browse files
authored
refactor(session): change session state saving from async to synchronous file operations (agentscope-ai#1339)
1 parent acecffa commit 34f53dc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/copaw/app/runner/session.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,12 @@ async def save_session_state(
8080
for name, state_module in state_modules_mapping.items()
8181
}
8282
session_save_path = self._get_save_path(session_id, user_id=user_id)
83-
async with aiofiles.open(
83+
with open(
8484
session_save_path,
8585
"w",
8686
encoding="utf-8",
87-
errors="surrogatepass",
8887
) as f:
89-
await f.write(json.dumps(state_dicts, ensure_ascii=False))
88+
f.write(json.dumps(state_dicts, ensure_ascii=False))
9089

9190
logger.info(
9291
"Saved session state to %s successfully.",

0 commit comments

Comments
 (0)