Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Longer running requests #12

Open
jochenonline opened this issue Aug 2, 2018 · 5 comments
Open

Longer running requests #12

jochenonline opened this issue Aug 2, 2018 · 5 comments

Comments

@jochenonline
Copy link

When I process a longer running request (aboz 2 seconds). The request will be destroyed before termination. Is there any chance to have those requests processed befor the server is destroyed?

@jochenonline
Copy link
Author

The problem seems to be that server.close() kills a running request. In the consequence of that the callback of server.close() is called although the current request has not ended properly. Any ideas?

@jochenonline
Copy link
Author

Just to make it clear: That what you stated in your article

The important part of the description to remember is "keeps existing connections". While close does stop the listening socket from accepting new ones, sockets that are already connected may continue to operate - which is fine if they're mid-request - but this also includes sockets that are connected with a 'keep-alive' connection type.

is not what I experience. When calling server.close() while a request is in process that request is terminated and lost. Did I do or understand something wrong?

@faroceann
Copy link

@jochenonline The quote is describing the behavior of native server.close(). The purpose of this library is to terminate those connections and work around the native behavior.

@jochenonline
Copy link
Author

I am speaking about the server.close() within the library. The library itself takes care of the non idle connections, but server.close() itself does not. And because the library calls server.close() a running request is terminated anyway.

@thedillonb
Copy link
Owner

@jochenonline server.close() does not terminate running requests. You might want to check if you have any other logic, or some sort of event handler that might be triggering that behavior.

From the official docs (https://nodejs.org/api/net.html#net_server_close_callback):

Stops the server from accepting new connections and keeps existing connections.

This aligns what I've only ever seen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants