NNext.js 中文网 GitHub

maxDuration

maxDuration 路由段配置选项的 API 参考。

maxDuration 选项允许你为路由段中的服务端逻辑设置最大执行时间(以秒为单位)。部署平台可以使用 Next.js 构建输出中的 maxDuration 来添加特定的执行限制。

layout.tsx | page.tsx | route.ts
export const maxDuration = 5
layout.js | page.js | route.js
export const maxDuration = 5

Server Actions#

如果使用 Server Actions,请在页面级别设置 maxDuration,以更改该页面上所有 Server Actions 的默认超时时间。

版本历史#

版本变更
v13.4.10引入 maxDuration。
Next.js 中文网