From e0b840871e3a01c1271633745d5eb5f67f0b1794 Mon Sep 17 00:00:00 2001 From: "@wwwjim" Date: Sat, 3 Oct 2020 20:57:11 -0700 Subject: [PATCH] 8 minute file upload timeout --- pages/api/data/[upload].js | 3 +++ pages/api/v1/upload-data/[id].js | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/pages/api/data/[upload].js b/pages/api/data/[upload].js index e0ce8419..e296545e 100644 --- a/pages/api/data/[upload].js +++ b/pages/api/data/[upload].js @@ -23,6 +23,9 @@ export default async (req, res) => { .send({ decorator: "UPLOAD_NOT_ALLOWED", error: true }); } + req.setTimeout(480000); + res.setTimeout(480000); + console.log(`[upload] upload for ${user.username} started`); const response = await Upload.formMultipart(req, res, { user, diff --git a/pages/api/v1/upload-data/[id].js b/pages/api/v1/upload-data/[id].js index eb84b5f0..6abcb220 100644 --- a/pages/api/v1/upload-data/[id].js +++ b/pages/api/v1/upload-data/[id].js @@ -83,6 +83,11 @@ export default async (req, res) => { id: key.owner_id, }); + console.log("[upload] establishing timeouts"); + req.setTimeout(480000); + res.setTimeout(480000); + console.log("[upload] timeouts set"); + const uploadResponse = await Upload.formMultipart(req, res, { user, });