Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
feat(UploadChunk): make connection timeout duration bigger (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijsKoud authored Jun 12, 2023
1 parent 54939c0 commit aa888af
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions apps/server/src/api/upload-chunk.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Response } from "express";
import type { NextFunction, Request, Response } from "express";
import { rm, stat, rename } from "node:fs/promises";
import { join } from "node:path";
import { Auth } from "../lib/Auth.js";
Expand Down Expand Up @@ -87,5 +87,10 @@ export default async function handler(server: Server, req: DashboardRequest, res
}
}

function timeoutMiddleware(server: Server, req: Request, res: Response, next: NextFunction) {
res.socket!.setTimeout(3.6e6);
next();
}

export const methods: RequestMethods[] = ["post"];
export const middleware: Middleware[] = [Auth.userApiKeyMiddleware.bind(Auth)];
export const middleware: Middleware[] = [timeoutMiddleware.bind(timeoutMiddleware), Auth.userApiKeyMiddleware.bind(Auth)];

1 comment on commit aa888af

@ijsKoud
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ijsblokjeee[bot] release v4.1.11

Please sign in to comment.