sort in internal scoring, extract latency keys in batch for top 100

This commit is contained in:
2024-12-17 03:39:02 -06:00
parent db9bcb06dc
commit 6c00da29a7
4 changed files with 58 additions and 8 deletions

View File

@@ -74,6 +74,10 @@ func (l *LatencyQueue) SetHandler(handler chan<- PingResult) {
l.handlerChannel = handler
}
func (l *LatencyQueue) GetSelfIP() net.IP {
return l.ipSelf
}
func (l *LatencyQueue) RefreshIP() error {
resp, err := http.Get("https://api.ipify.org?format=text")
if err != nil {
@@ -145,8 +149,6 @@ func (l *LatencyQueue) Start(ctx context.Context) {
pinger.Interval = time.Nanosecond
pinger.Timeout = time.Millisecond * 500
l.logger.Debugw("Ping Request", "ip", ip)
// Process the request
err = pinger.Run()
if err != nil {