You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found in helper.js, we open the file to get the fileDescriptor using fs.openSync(filePath, 'r').
But do we need to close it when the server is closed?
Sorry for the late response. In case you're still interested:
That could be a problem if we wrote to the files, or if we opened many different files for different endpoints and ran out of Unix sockets. Neither if the two happens in this.
This solution is a bit more efficient as we open the files when the server is fired up, so we can read the file contents straight away upon receiving a request. You are right, however, that it would be safer and nicer to only open the files when they are needed and close them once their content is sent.
Would you be up for opening a pull request to fix this?
Activity
xiabin1235910 commentedon Nov 8, 2017
like in
helper.jsShadowbeetle commentedon Apr 24, 2018
Sorry for the late response. In case you're still interested:
That could be a problem if we wrote to the files, or if we opened many different files for different endpoints and ran out of Unix sockets. Neither if the two happens in this.
This solution is a bit more efficient as we open the files when the server is fired up, so we can read the file contents straight away upon receiving a request. You are right, however, that it would be safer and nicer to only open the files when they are needed and close them once their content is sent.
Would you be up for opening a pull request to fix this?