question: set timeout for a specific route
Abdullah8006 opened this issue · 3 comments
Abdullah8006 commented
I was trying to...
I have a route that processes batch data and takes quite some time(~1 minute) to process the data.
@Post('/fhir/batch')
@HttpCode(StatusCodes.CREATED)
public async createBatchAppointments(
@Body({ options: { limit: '250mb' } }) batchAppointments: FhirAppointmentModel[], @HeaderParam('x-partner-id') partnerId: number,
@Res() response: Response): Promise<Response> {
const createBatchApptResponse = await this.appointmentBatchProcessorService.createAppointmentInBatchForFhir(batchAppointments, partnerId);
return response.status(StatusCodes.CREATED).send(createBatchApptResponse);
}
The problem:
For the first batch request the route works just fine but for subsequent requests the server throws
`Request failed with status code 504`
How can I set/increase the timeout of such time-taking requests?
attilaorosz commented
@Abdullah8006 Sorry for the late response. You can get the request object with @Req(), then you can manipulate it like a normal express request (assuming you are using express).
Example:
req.setTimeout(60 * 1000); //use req. this sets timeout to 60 secondsattilaorosz commented
Closing due to inactivity
github-actions commented
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.