hrhyt
hrhyt

Reputation: 23

How can I set timeout in LB4?

I am using LoopBack 4(LB4). Access to the API disconnects in 120 seconds. I want the timeout to be greater than 120 seconds.

I use LB4 with AWS Elastic Beanstalk Worker. I want to change the timeout value for processing that takes more than 120 seconds.

Timeout value could be changed when using http-server-default-timeout option. https://nodejs.org/docs/latest-v12.x/api/cli.html#cli_http_server_default_timeout_milliseconds

However, the above option can only be used on nodejs 12.x.

I want to know how to change server.timeout in Nodejs 10.x

Upvotes: 1

Views: 1306

Answers (1)

Zhikai Xiong
Zhikai Xiong

Reputation: 397

export class TestController {
    constructor(
        @inject(RestBindings.Http.RESPONSE) private response: Response
    ) {
        (this.response as any).setTimeout(1000);
    }
}

This works.

Upvotes: 3

Related Questions