fix(gateway): run channel-directory write off the event loop
atomic_json_write() calls os.fsync(), which blocks until the write reaches stable storage. build_channel_directory() already offloads its builders with asyncio.to_thread (#60794) but still called the persist step directly on the loop, so the Discord heartbeat waited on a disk flush.
This commit is contained in:
@@ -206,7 +206,7 @@ async def build_channel_directory(adapters: Dict[Any, Any]) -> Dict[str, Any]:
|
||||
}
|
||||
|
||||
try:
|
||||
atomic_json_write(DIRECTORY_PATH, directory)
|
||||
await asyncio.to_thread(atomic_json_write, DIRECTORY_PATH, directory)
|
||||
except Exception as e:
|
||||
logger.warning("Channel directory: failed to write: %s", e)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user