Skip to content

fix: unblock registration start event loop and restore long POST client#27

Open
hexxyan wants to merge 1 commit into
HM2899:mainfrom
hexxyan:fix/reg-start-unblock-event-loop
Open

fix: unblock registration start event loop and restore long POST client#27
hexxyan wants to merge 1 commit into
HM2899:mainfrom
hexxyan:fix/reg-start-unblock-event-loop

Conversation

@hexxyan

@hexxyan hexxyan commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Offload sync registration orchestration (start_registration / resume / reclaim / device login) from the FastAPI async event loop via asyncio.to_thread, so concurrent /sessions and /stop keep answering while start is slow.
  • Re-wire sharedRegistrationLongHTTP into registrationClient().HTTPLong. The HTTPLong field already existed on the client, but construction dropped it after an admin/shell merge, so long POST /jobs still used the 750ms poll client and returned admin 502 timeout awaiting response headers.

Context / why not #22

PR #22 fixed the read path (bounded /sessions list, cache, prune). This PR fixes the write path: start blocked the sidecar event loop, and Go's long POST timeout wiring was missing in practice.

Test plan

  • Local: while /jobs was in-flight, /health /sessions /stop returned 200 within ~200ms (previously all timed out).
  • Local: admin POST /admin/api/accounts/register-email returned 200 instead of 502 under the same config.
  • Reviewer: smoke start + stop + refresh on a small batch with local captcha provider.

POST /jobs ran start_registration synchronously inside an async FastAPI
handler, freezing the sidecar event loop so concurrent /sessions and
/stop missed the 750ms poll budget and surfaced as admin 502s.

Offload start/resume/reclaim/device-login to asyncio.to_thread. Also
re-wire sharedRegistrationLongHTTP into client.HTTPLong (field existed
but was accidentally dropped from registrationClient construction).
@HM2899

HM2899 commented Jul 24, 2026

Copy link
Copy Markdown
Owner

谢谢佬的提交,晚点更新新版本,合并

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