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

Fix monitoring server connz idle time sorting #4463

Merged
merged 1 commit into from Sep 1, 2023

Conversation

mdawar
Copy link
Contributor

@mdawar mdawar commented Aug 31, 2023

  • Link to issue, e.g. Resolves #NNN
  • Documentation added (if applicable)
  • Tests added
  • Branch rebased on top of current main (git pull --rebase origin main)
  • Changes squashed to a single commit (described here)
  • Build is green in Travis CI
  • You have certified that the contribution is your original work and that you license the work to the project under the Apache 2 license

Resolves #4462

Changes proposed in this pull request:

  • Changed how byIdle struct compares the idle times (was subtracting the start time from the last activity time).
  • Added tests for byIdle.
  • Changed and simplified the test TestConnzSortedByIdle (No need for the clients to publish and subscribe if we are manually changing the client's last time, and we only need to test the sorting order). Also the test was not catching the problem because the clients start time was the same, now every client has a different start time.

@mdawar mdawar requested a review from a team as a code owner August 31, 2023 15:41
@derekcollison
Copy link
Member

I think you may have introduced a deadlock by looks of travis tests.

@derekcollison
Copy link
Member

If you can rebase onto top of main and see if that clears tests, and if not then the change has a deadlock.

"time"
)

func TestSortByIdleTime(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the rebase, let's move this back to monitor_test.go and rename this test to:

Suggested change
func TestSortByIdleTime(t *testing.T) {
func TestConnzSortByIdleTime(t *testing.T) {

@mdawar
Copy link
Contributor Author

mdawar commented Sep 1, 2023

Done, rebased on top of main and moved the test from the new file to monitor_test.go.

Copy link
Member

@wallyqs wallyqs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wallyqs wallyqs merged commit ed8b50d into nats-io:main Sep 1, 2023
1 check passed
@mdawar mdawar deleted the connz-idle-sort branch September 1, 2023 16:56
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.

Monitoring server not sorting connections by idle time correctly
3 participants