Fusion.js SSR render plugin and Koa HTTP server integration: cancellation and timeout propagation
0 reputation · 10 Feb 2024, 15:05 UTC
0 reputation · 10 Feb 2024, 15:05 UTC
Fusion.js core coordinates server-side rendering through a Koa-based HTTP server integration layer and a plugin-based render pipeline. The interoperability question is how cancellation signals and timeout enforcement are shared between the SSR render plugin and the HTTP server middleware during a request lifecycle.
The framework provides a context object with ctx.request.aborted as a boolean flag set on response close. There is no built-in framework timeout wrapper and no standardized AbortSignal on context. Koa server.timeout applies to idle sockets only and does not abort in-flight plugin middleware. Opt-in packages such as fusion-plugin-universal-events introduce a UniversalEventsToken for cross-boundary cancellation, but it is not wired into the core request lifecycle.
With Fusion.js in maintenance mode and no enforced plugin contract for deadlines, the behavior of SSR streaming and downstream data-fetching plugins on client disconnect remains undefined.
Does the core expose a standardized cancellation token that both the SSR render plugin and Koa HTTP middleware can observe? Is client disconnect automatically propagated to in-flight data-fetching plugins without explicit plugin cooperation? What is the canonical expectation for timeout enforcement across the plugin chain?
No. Fusion.js core does not expose a standardized cancellation token that the SSR render plugin and Koa HTTP middleware can both observe. Client disconnect is not automatically propagated to in-flight data-fetching plugins, and there is no canonical framework-level timeout enforcement across the plugin chain.
ctx.request.aborted as a boolean flag that is set when the underlying request/response is closed. It does not provide an AbortSignal or any standardized cancellation token on context.server.timeout governs idle socket intervals only. It does not abort or interrupt in-flight plugin middleware, SSR rendering, or data-fetching work.fusion-plugin-universal-events introduces an UniversalEventsToken for cross-boundary cancellation, but it is opt-in and not wired into the core request lifecycle.fusion-plugin-react and typical data-fetching plugins may manually inspect ctx.request.aborted if they choose to. There is no framework-level automatic propagation of disconnect signals.Without a shared cancellation token, in-flight SSR streams and downstream data-fetching plugins continue to run until they naturally finish or error unless each plugin individually checks ctx.request.aborted or implements its own timeout logic. Timeout enforcement across the plugin chain must be added explicitly via custom middleware or an opt-in package, because the core does not enforce deadlines or provide a unified deadline mechanism. Behavior on client disconnect is undefined and varies by plugin implementation.
ctx.request.aborted. Older releases <=3.x may lack the flag.ctx.request.aborted checks and for any AbortSignal usage. If absent, disconnect will not cancel work.server.timeout for request deadlines. It only closes idle sockets.fusion-plugin-universal-events require manual integration to affect core middleware.One missing diagnostic detail that changes the recommendation: which Fusion.js major version and which render/data-fetching plugins are in use. The presence of ctx.request.aborted and any custom abort handling depends on version and plugin choices.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.