Skip to content

feat(container-loader): structured concurrency with effection for connection retry loops#26406

Draft
tylerbutler wants to merge 1 commit intomicrosoft:mainfrom
tylerbutler:feat/effection-connection-manager
Draft

feat(container-loader): structured concurrency with effection for connection retry loops#26406
tylerbutler wants to merge 1 commit intomicrosoft:mainfrom
tylerbutler:feat/effection-connection-manager

Conversation

@tylerbutler
Copy link
Member

@tylerbutler tylerbutler commented Feb 11, 2026

Summary

  • Converts the ConnectionManager's connection retry loop and reconnection logic to use effection 4.0 generator-based Operations, illustrating how structured concurrency simplifies complex async lifecycle management
  • Replaces manual AbortController/setTimeout/Promise wiring in connectCore() with a *retryConnectOperation() generator using yield* call() and yield* sleep()
  • Replaces the async reconnect() method with a *reconnectOperation() generator using the same effection primitives
  • Cancellation is now handled via effection's Task.halt() instead of AbortController.abort() — the generator simply stops at the next yield point
  • Removes boilerplate: no more AbortController setup, no manual abortSignal.aborted checks, no new Promise(resolve => setTimeout(resolve, delayMs)) patterns

All external APIs remain unchanged.

Test plan

  • TypeScript compiles (ESM + CJS) with no errors
  • ESLint passes cleanly
  • All 220 unit tests pass
  • Existing tests for retry loops, nack handling, reconnection delays, and ReconnectMode continue to work with sinon fake timers
  • Manual verification in a real Fluid session (future)

@tylerbutler tylerbutler changed the title feat(container-loader): introduce effection for structured concurrency feat(container-loader): structured concurrency with effection for connection retry loops Feb 11, 2026
Replace manual AbortController/setTimeout-based async lifecycle management
in ConnectionManager with effection 4.0 generator-based Operations.

- Convert connectCore() retry loop to *retryConnectOperation() generator
  using yield* call() and yield* sleep() instead of await/setTimeout
- Convert reconnect() to *reconnectOperation() generator
- Replace IPendingConnection.abort() with Task.halt() for cancellation
- Update all callers (reconnectOnError, sendMessages, beforeProcessingIncomingOp)
  to use run(() => reconnectOperation(...))
- Add try-catch around storageOnly path in connect() for error parity
- Adjust test to use clock.tickAsync(0) for effection microtask flushing
@tylerbutler tylerbutler force-pushed the feat/effection-connection-manager branch from a1c0562 to 057459c Compare February 11, 2026 00:36
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.

1 participant