8000 perf(activity): write request rows off the event loop by adeelahmad · Pull Request #132 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

perf(activity): write request rows off the event loop - #132

Merged
adeelahmad merged 1 commit into
mainfrom
claude/activity-history-budgets-3sllyj
Oct 4, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/activity-history-budgets-3sllyj

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Before: the activity middleware wrote its ledger row on the event loop after every changing request. While that write ran, other requests waited.

After: the row is written in a worker thread. Other requests carry on while it is written, and the row still exists by the time the request finishes, so tests and history reads see it at once.

How: activity.Middleware now runs _log with asyncio.to_thread. That copies the request's context, so the resources the request attributed are kept.

Full backend suite (embedded engine): 593 passed. The only failures were the two known environmental tests (conversion, voice).

🤖 Generated with Claude Code

https://claude.ai/code/session_01AMq5CNuWmtn3Suj1EamYBT


Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AMq5CNuWmtn3Suj1EamYBT
@adeelahmad
adeelahmad merged commit bc16461 into main Oct 4, 2026
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0