Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Disables KeepAlive timeout when debugger is attached to the functions emulator. (#6069)
13 changes: 11 additions & 2 deletions src/emulator/functionsRuntimeWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ export class RuntimeWorker {
});
}

request(req: http.RequestOptions, resp: http.ServerResponse, body?: unknown): Promise<void> {
request(
req: http.RequestOptions,
resp: http.ServerResponse,
body?: unknown,
debug?: boolean
): Promise<void> {
if (this.triggerKey !== FREE_WORKER_KEY) {
this.logInfo(`Beginning execution of "${this.triggerKey}"`);
}
Expand Down Expand Up @@ -176,6 +181,10 @@ export class RuntimeWorker {
const piped = _resp.pipe(resp);
piped.on("finish", () => finishReq("finish"));
});
if (debug) {
proxy.setSocketKeepAlive(false);
proxy.setTimeout(0);
}
proxy.on("timeout", () => {
this.logger.log(
"ERROR",
Expand Down Expand Up @@ -367,7 +376,7 @@ export class RuntimeWorkerPool {
if (debug) {
await worker.sendDebugMsg(debug);
}
return worker.request(req, resp, body);
return worker.request(req, resp, body, !!debug);
}

getIdleWorker(triggerId: string | undefined): RuntimeWorker | undefined {
Expand Down