diff --git a/backend/fetch/fetcher/fetcher.go b/backend/fetch/fetcher/fetcher.go index 4697b99..fe69dcf 100644 --- a/backend/fetch/fetcher/fetcher.go +++ b/backend/fetch/fetcher/fetcher.go @@ -96,10 +96,10 @@ func getServers() ([]klei.Server, error) { log.Infof("Found %v servers", len(lobby)) // Collect the details (player info etc.) of each server. - servers, count := klei.Servers(lobby, region) + servers := klei.Servers(lobby, region) result = append(result, servers...) - log.Infof("Parsed in %.2fs with %v/%v failing", time.Since(start).Seconds(), count, len(servers)) + log.Infof("Parsed in %.2fs with %v/%v failing", time.Since(start).Seconds(), len(lobby)-len(servers), len(lobby)) } return result, nil diff --git a/backend/fetch/klei/servers.go b/backend/fetch/klei/servers.go index b136e43..47dc9e5 100644 --- a/backend/fetch/klei/servers.go +++ b/backend/fetch/klei/servers.go @@ -62,17 +62,15 @@ func (d Server) Location(geoip *geoip2.Reader) (string, string, string) { return record.Country.Names["en"], record.Continent.Names["en"], record.Country.IsoCode } -func Servers(lobby []LobbyEntry, region string) ([]Server, int) { +func Servers(lobby []LobbyEntry, region string) []Server { var result []Server wp := workerpool.New(1000) - ch := make(chan struct{}, len(lobby)) for _, entry := range lobby { wp.Submit(func() { details, err := readEntry(entry, region) if err != nil { - ch <- struct{}{} return } @@ -83,12 +81,7 @@ func Servers(lobby []LobbyEntry, region string) ([]Server, int) { wp.StopWait() // Atomic counter did not work. Poor try at counting errors. - count := 0 - for len(ch) > 0 { - count++ - } - - return result, count + return result } // token as per https://forums.kleientertainment.com/forums/topic/115578-retrieving-dst-server-data