Explorar o código

close HTTP keep-alive connections when shutting down

Brian Gough %!s(int64=11) %!d(string=hai) anos
pai
achega
74fc095913
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      services/filestore/app.coffee

+ 6 - 0
services/filestore/app.coffee

@@ -62,6 +62,12 @@ app.use (req, res, next) ->
 app.get  "/project/:project_id/file/:file_id", keyBuilder.userFileKey, fileController.getFile
 app.post "/project/:project_id/file/:file_id", keyBuilder.userFileKey, fileController.insertFile
 
+app.use (req, res, next) ->
+	if not appIsOk
+		# when shutting down, close any HTTP keep-alive connections
+		res.set 'Connection', 'close'
+	next()
+
 app.put "/project/:project_id/file/:file_id", keyBuilder.userFileKey, fileController.copyFile
 app.del "/project/:project_id/file/:file_id", keyBuilder.userFileKey, fileController.deleteFile