Skip to content

Commit

Permalink
fix idle timeout issue
Browse files Browse the repository at this point in the history
details of bug are here: nodejs/node#13391
docs here: https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_server_keepalivetimeout

tl;dr is node set a 5s idle timeout. this does what go and java both seem to
do (have not checked python or ruby, though from what I know about python,
we are not doing this either) and doesn't have an idle timeout. since in this
case we do kinda trust that the client is using an idle timeout (it's fn),
this seems like the right policy anyway (if fn dies is something to consider,
but the least of our worries is fdk conns in that case, and we are killing fn
spawned containers on startup too). it should also be noted the client (fn) is
only using 1 conn per container.
  • Loading branch information
rdallman committed Apr 13, 2019
1 parent a028b75 commit 63ca21a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fn-fdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ function handleHTTPStream (fnfunction, options) {
}

let currentServer = http.createServer(functionHandler)
.listen(tmpFile, () => {
currentServer.keepAliveTimeout = 0 // turn off
currentServer.listen(tmpFile, () => {
fs.chmodSync(tmpFile, '666')
fs.symlinkSync(tmpFileBaseName, listenFile)
})
Expand Down

0 comments on commit 63ca21a

Please sign in to comment.