Skip to content

The agent that grows with you

refactor(gateway): the fence-refusal session read runs off the event loop

Teknium528d2b0dc9fa
diff --git a/gateway/session_controls.py b/gateway/session_controls.py
index 116adfa09e8..ba4e3060e51 100644
--- a/gateway/session_controls.py
+++ b/gateway/session_controls.py
@@ -601,7 +601,7 @@ class AuthorityConnection:
except RuntimeStoreError as exc:
if exc.reason in {'revision_conflict', 'stale_generation'}:
# The fresh fences ride on the refusal, so the client retries once without a re-read.
- row = self.authority.db.get_session(ref.session_id)
+ row = await asyncio.to_thread(self.authority.db.get_session, ref.session_id)
if row is not None:
exc.revision, exc.execution_generation = row['runtime_revision'], row['runtime_generation']
raise