Skip to content

Cancel scheduled ControlConnection refresh if shutdown was called #440

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

betalb
Copy link

@betalb betalb commented May 5, 2025

Store timeout, used to schedule refresh call, and clear it on shutdown.

Even though refresh call has check if shutdown was called, timeout itself may prevent nodejs process from shutting down until timeout is reached.

I have some concerns about test itself. Not sure that all the setup steps are required. But I've copied it mostly from previous test "should reconnect when all hosts go down and back up". What I wanted from the test:

  • spin up cluster
  • open control connection and ensure that it is live
  • stop cluster
  • call control connection shutdown
  • verify that refresh was not called

So the main test is pasted below, the rest is a boilerplate copied from other test.

// start spying on _refresh calls
cc._refresh = sinon.spy(cc._refresh);

cc.shutdown();

// wait for reconnectionDelay with 10% lag
await helper.delayAsync(parseInt(reconnectionDelay * 1.1, 10));

assert.ok(cc._refresh.notCalled);

Store timeout, used to schedule _refresh call, and clear it on
shutdown. Even though _refresh call has check if shutdown was called,
timeout itself may prevent nodejs process from shutting down until
timeout reached.
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.

1 participant