r27447 - Optional ping test at login by @Veracity0 in

This integrates the "ping" infrastructure added in r27446 with the login process to allow the user to detect if the server they just logged in to is going to be too slow for them.

The Connection tab on the Login Frame allows you to configure 4 parameters:

1) pingLogin

Do a ping test - 10 api.php requests - after login.php has been processed but before any further requests are issued to refresh the session. It logs the result to the gCLI and, even if you have not configured KoLmafia to check if the connection is too slow, this will help you decide HOW to configure such a check, if desired, by remembering your fastest (or slowest) average ping time.

This ping test normally takes about 300 msec for me (in Boston). I am sure that it is faster or slower elsewhere in the world. But this doesn't seem too egregious, compared to the many seconds it takes to complete refreshing your session, so this defaults to "true"

2) pingLoginCheck

Assuming pingLogin was "true", evaluate the result of the ping test.

none - Nah. Don't bother. Just accept whatever connection you get. This is the default.
goal - an integer. Presumably based on observed ping tests. For me, I use a goal of 30 msec, since that's an easy to achieve "good" api.php lag.
threshold - a float representing fractional percent above your lowest saved ping time. So, if your lowest saved ping is 25 msec, a threshold of 0.20 will accept 25 * 1.20 = 30 msec.

3) pingLoginGoal - an integer. maximum average ping time (from api.php using at least 10 pings) in msec. Defaults to 0, which will always be unacceptable, but which will let you look at the ping and decide if you like it - and if so, presumably you can use that value to help you set this property reasonably for future logins.

4) pingThreshold - a float, defaulting to 0.20. That is probably reasonable, unless you get an anomalously low ping test. I am pondering solutions for that.

How is this used?

0) You see the Login Frame.
1) Click "login"
2) We submit login.php
3) When it completes - before continuing to refresh the session - do a ping test.
4) (If it is acceptable, per your configure properties, continue logging in the session without a prompt)
5) If it is not acceptable, pop up a dialog with the ping time, your required maximum value, and ask if it is acceptable
6a) Click Yes - continue refreshing the session
6b) Click No - call logout.php and go back to step 2
6c) Click Cancel or close the dialog - call logout.php and go back to step 0

I think this is pretty sweet. If you want to use it, go to the Connection tab in the Login Frame and enable it.
 
Back
Top