Cloudflare Workers 运行时更新宽限期从30秒延长至20分钟
Workers - More time for requests to finish during Workers runtime updates
严重影响长连接稳定性的关键基础设施变更。WebSocket 和流式 AI 服务读者必须知晓此行为变化,并据此调整重连策略与超时设置,防止更新导致业务中断。
Pending requests and connections to Workers now have a grace period of up to 20 minutes during Workers runtime updates. Previously, the grace period was up to 30 seconds.
在 Workers 运行时更新期间,待处理的请求和连接到 Workers 的连接有长达 20 分钟的宽限期。此前,宽限期最长为 30 秒。
This gives long-running HTTP requests, streamed AI responses, and live WebSocket sessions more time to continue before an update interrupts them.
这为长时间运行的 HTTP 请求、流式 AI 响应以及实时 WebSocket 会话提供了更多时间,以便在更新中断它们之前继续运行。
New incoming HTTP requests go to the updated version of the Workers runtime once it is ready. Processes running the previous version stop accepting these requests and drain existing work. The grace period applies to each process running the previous version. When it ends, unfinished requests and open connections on that process are terminated.
一旦更新的 Workers 运行时版本准备就绪,新的传入 HTTP 请求将路由至该新版本。运行前一版本的进程将停止接受这些请求,并处理完现有工作。宽限期适用于每个运行前一版本的进程。当宽限期结束时,该进程上未完成的请求和打开的连接将被终止。
You should design your application to reconnect WebSockets, safely retry interrupted requests, and recover saved state after a restart. WebSockets can disconnect before the grace period ends, including connections using the WebSocket Hibernation API.
您应设计应用程序以重新连接 WebSocket,安全地重试被中断的请求,并在重启后恢复保存的状态。WebSocket 可能在宽限期结束前断开连接,包括使用 WebSocket Hibernation API 的连接。
For more information, refer to Workers runtime updates.
更多信息,请参阅 Workers 运行时更新。
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力