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

Abort ping test if pings are too long #1872

Merged
merged 7 commits into from
Aug 4, 2023
Merged

Abort ping test if pings are too long #1872

merged 7 commits into from
Aug 4, 2023

Conversation

Veracity0
Copy link
Contributor

@Veracity0 Veracity0 commented Aug 2, 2023

Shiverwarp complained recently that he was getting login ping test times of 23000+ msec and it was taking seemingly forever to login. I sympathize; I usually get <30 msec and the longest I've see in a 10-ping test is a bit more than 800 - which would still be an intolerably slow connection. And to think it took 10 pings to get that "average".

I can't imagine what caused Shiverwarp's insanely bad connection, but if it took 4 minutes to run the first test and decide it is time to retry, seems to me that we could recognize way earlier - as early as the very first ping - that this connection is a no-go.

  1. Comparing ping average times with goals and thresholds in floating point seems right, but displaying them as integers, calculated either by Math.round() or Math.floor(), is problematic. If your threshold calculation says you cannot exceed 30.2 msec and you generate 30.4, it will fail, and using Math.round, will report "you wanted 30 msec but got 30 msec, so it failed". I changed it to display floating point results in floating point. So far, it always seems to display with a single digit to the right of the decimal point, which seems fine.

  2. If you get a really slow connection, it will be obvious early on that it will be too slow.
    Allow configuration for "PingAbortTrigger" triggers.

If "pingTestAbort" has "4:3|1:10", you are specifying:

Retry if 4 pings exceed 3 times average historical ping
Retry if 1 ping exceeds 10 times average historical ping

Default is "1:10"

On the PingOptionsPanel, you can add rows to specify additional abort triggers or delete rows to remove them. If you try to delete the last row, it just zeroes it - which will leave the property empty.

I think the GUI is pretty spiffy.

PingManager now checks those triggers after each ping it submits. If that results in any trigger firing - 4 exceeding 3 times historical average or 1 exceeding 10 times historical average, from the above example - PingManager aborts the ping test and returns the test with the trigger that fired to LoginManager.

Could be that the aborted ping test was still good enough, but if not, it reports that the ping test aborted and it moves on to the next timein attempt.

@codecov
Copy link

codecov bot commented Aug 2, 2023

Codecov Report

Merging #1872 (f5878cc) into main (5b51315) will decrease coverage by 0.05%.
The diff coverage is 0.49%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1872      +/-   ##
============================================
- Coverage     36.36%   36.32%   -0.05%     
  Complexity    18780    18780              
============================================
  Files          1081     1081              
  Lines        166364   166557     +193     
  Branches      35399    35431      +32     
============================================
+ Hits          60506    60507       +1     
- Misses        95973    96165     +192     
  Partials       9885     9885              
Files Changed Coverage Δ
...net/sourceforge/kolmafia/session/LoginManager.java 0.00% <0.00%> (ø)
...net/sourceforge/kolmafia/swingui/OptionsFrame.java 0.00% <0.00%> (ø)
...forge/kolmafia/swingui/panel/PingOptionsPanel.java 0.00% <0.00%> (ø)
.../net/sourceforge/kolmafia/session/PingManager.java 21.53% <1.29%> (-12.92%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5b51315...f5878cc. Read the comment docs.

@Veracity0 Veracity0 marked this pull request as ready for review August 3, 2023 21:09
@Veracity0 Veracity0 requested a review from a team as a code owner August 3, 2023 21:09
Copy link
Contributor

@jaadams5 jaadams5 left a comment

Choose a reason for hiding this comment

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

Eyes a little glazed but...

@Veracity0
Copy link
Contributor Author

Eyes a little glazed but...

Did you try it out? I'll merge it and you can see for yourself.

@Veracity0 Veracity0 merged commit 00fefe4 into main Aug 4, 2023
8 checks passed
@Veracity0 Veracity0 deleted the ping-test-abort branch August 4, 2023 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants