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

Add a keepAlive option and enable SO_KEEPALIVE by default #24

Merged
merged 3 commits into from
Oct 20, 2023

Conversation

rgrove
Copy link
Contributor

@rgrove rgrove commented Aug 30, 2023

Enabling SO_KEEPALIVE on memcached connections helps prevent idle connections from being closed. This resolves an issue I was experiencing in which I saw multiple ECONNRESET errors per hour, causing the client to have to reconnect each time.

This change enables SO_KEEPALIVE by default with an initial delay of 1 minute following the last server-sent packet. The delay may be customized by providing a number of milliseconds as the value of the new keepAlive client option, or keepalive may be disabled entirely by setting the keepAlive option to false.

I also took a shot at simplifying the TCP_NODELAY unit tests I added in PR #20 in hopes of addressing the issue where GitHub Actions never seems to finish running tests, although I still haven't been able to reproduce that behavior locally.

Enabling `SO_KEEPALIVE` on memcached connections helps prevent idle
connections from being closed. This resolves an issue I was experiencing
in which I saw multiple `ECONNRESET` errors per hour, causing the client
to have to reconnect each time.

Keepalive is enabled by default with an initial delay of 1 minute
following the last server-sent packet. The delay may be customized by
providing a number of milliseconds as the value of the new `keepAlive`
client option, or keepalive may be disabled entirely by setting the
`keepAlive` option to `false`.
I realized it's not necessary to call `startSingleServer()`, and it
_may_ be necessary to shut down the client (although some other tests
don't seem to do this).

This doesn't actually change anything about test completion time when I
run them locally, but maybe it has something to do with why tests seem
to hang in GitHub Actions?
@rgrove
Copy link
Contributor Author

rgrove commented Aug 30, 2023

I also took a shot at simplifying the TCP_NODELAY unit tests I added in PR #20 in hopes of addressing the issue where GitHub Actions never seems to finish running tests, although I still haven't been able to reproduce that behavior locally.

Looks like it worked! 🎉

@QuChen88
Copy link
Contributor

QuChen88 commented Sep 6, 2023

Looks good to me.

@QuChen88
Copy link
Contributor

QuChen88 commented Sep 9, 2023

@smuthya Can you please review/merge this PR?

@smuthya smuthya merged commit 3f7f8db into electrode-io:master Oct 20, 2023
1 check passed
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

Successfully merging this pull request may close these issues.

3 participants