From 02100d27eac9166990c84004a51bbfb031f0e6d7 Mon Sep 17 00:00:00 2001 From: Aggre Date: Tue, 23 Jul 2024 15:03:09 +0900 Subject: [PATCH] set maxDuration for functions that have slow tasks --- src/pages/api/cron/assets.ts | 2 -- src/pages/api/profile/[id]/assets.ts | 2 -- vercel.json | 8 ++++++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pages/api/cron/assets.ts b/src/pages/api/cron/assets.ts index ca8a9bfff..463740f29 100644 --- a/src/pages/api/cron/assets.ts +++ b/src/pages/api/cron/assets.ts @@ -14,8 +14,6 @@ const { PUBLIC_INFURA_KEY } = import.meta.env const queue = new PQueue({ concurrency: 5 }) -export const maxDuration = 30 - const sTokensPropertyAddressFetcher = async ( contract: Contract, id: string, diff --git a/src/pages/api/profile/[id]/assets.ts b/src/pages/api/profile/[id]/assets.ts index c3685e6c3..bb3aff115 100644 --- a/src/pages/api/profile/[id]/assets.ts +++ b/src/pages/api/profile/[id]/assets.ts @@ -82,8 +82,6 @@ export type AssetsResponse = { memberships: AssetItem[] } -export const maxDuration = 30 - const fetchAllMemberships = async ({ id, provider, diff --git a/vercel.json b/vercel.json index e1b4f29ff..0ee36e17f 100644 --- a/vercel.json +++ b/vercel.json @@ -9,6 +9,14 @@ "schedule": "0 0 * * *" } ], + "functions": { + "src/pages/api/profile/[id]/assets.ts": { + "maxDuration": 300 + }, + "src/pages/api/cron/**/*": { + "maxDuration": 300 + } + }, "git": { "deploymentEnabled": false }