Skip to content

Commit

Permalink
fix: Disable the default timeout for requests on the LU build (#4295)
Browse files Browse the repository at this point in the history
* Fix #4294 - Disable the default timeout for requests on the LU build step which can take > 2 minutes for large models

* update mocked request object to contain settimeout

Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>
  • Loading branch information
benbrown and cwhitten committed Nov 17, 2020
1 parent 771af33 commit 9d01a7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ describe('publish luis files', () => {
crossTrainConfig: {},
luFiles: [],
},
setTimeout: (msecs: number, callback: () => any): void => {},
} as Request;
await ProjectController.build(mockReq, mockRes);
expect(mockRes.status).toHaveBeenCalled();
Expand Down
5 changes: 5 additions & 0 deletions Composer/packages/server/src/controllers/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ async function build(req: Request, res: Response) {
const projectId = req.params.projectId;
const user = await ExtensionContext.getUserFromRequest(req);

// Disable Express' built in 2 minute timeout for requests. Otherwise, large models may fail to build.
req.setTimeout(0, () => {
throw new Error('LUIS publish process timed out.');
});

const currentProject = await BotProjectService.getProjectById(projectId, user);
if (currentProject !== undefined) {
try {
Expand Down

0 comments on commit 9d01a7a

Please sign in to comment.