SAP Spartacus 服务器端渲染 timeout 和 forcedSsrTimeout 两个参数的区别
timeout
Time in milliseconds to wait for SSR rendering to happen.
It does not mean the actual duration spent by a SSR rendering request, but the range between the timestamp when SSR receives a render request and that request actually gets processed by SSR server.
等待 SSR 渲染发生的时间(以毫秒为单位)。
它并不意味着 SSR 渲染请求所花费的实际持续时间,而是 SSR 收到渲染请求时的时间戳与该请求实际被 SSR 服务器处理之间的范围。
forcedSsrTimeout
Time in milliseconds to wait for rendering when SSR_ALWAYS render strategy is set for the request.
Default value is 60 seconds.
in file optimized-ssr-engine.ts, we set a timer with timeout value specified by line 130, this.getTimeout function call:
为请求设置 SSR_ALWAYS 渲染策略时等待渲染的时间(以毫秒为单位)。
默认值为 60 秒。
在文件优化 ssr-engine.ts 中,我们设置了一个定时器,其超时值由第 130 行指定,this.getTimeout 函数调用:
The logic of final timeout value is determined as below:
if request rendering strategy is specifed explicitly by customers to ALWAYS_SSR, then the timeout is coming from forcedSsrTimeout option. If customers specify ALWAYS_SSR but forget to fill forcedSsrTimeout, then 60 seconds is used as default value.
In most cases customers will use RenderingStrategy.DEFAULT as default strategy. In this case, timeout value comes from option timeout.
In other words, forcedSsrTimeout only takes effect, if customer uses RenderingStrategy.ALWAYS_SSR.
如果客户明确指定了请求渲染策略到 ALWAYS_SSR,那么超时来自于forcedSsrTimeout 选项。 如果客户指定ALWAYS_SSR但忘记填写forcedSsrTimeout,则使用60秒作为默认值。
在大多数情况下,客户会使用 RenderingStrategy.DEFAULT 作为默认策略。 在这种情况下,超时值来自选项超时。
换句话说,只有在客户使用 RenderingStrategy.ALWAYS_SSR 时,forcedSsrTimeout 才会生效。