// GetSteamAPIKey gets a steam API key. It picks any steam API key
// stored that has not been used in the last $KEY_SLEEP_TIME ms,
// If none are found then the function waits a short period
// and tries again until one is returned.
GetSteamAPIKey gets a steam API key. It picks any steam API key
stored that has not been used in the last $KEY_SLEEP_TIME ms,
If none are found then the function waits a short period
and tries again until one is returned.
// GetSteamAPIKey gets a steam API key . It picks any steam API key // stored that has not been used in the last $KEY_SLEEP_TIME ms // If none are found then the function waits a short period // and tries again until one is returned .
func GetSteamAPIKey() string {
	keyGetLock.Lock()
	for {
		for i, usableKey := range configuration.UsableAPIKeys.APIKeys {
			timeSinceLastUsed := time.Now().Sub(usableKey.LastUsed)
			if timeSinceLastUsed > keyUsageTime {
				configuration.UsableAPIKeys.APIKeys[i].LastUsed = time.Now()
				keyGetLock.Unlock()
				return usableKey.Key
			}
		}
		time.Sleep(time.Duration(3) * time.Millisecond)
	}
}
func GetSteamAPIKey ( ) string { keyGetLock . Lock ( ) for { for i , usableKey := range configuration . UsableAPIKeys . APIKeys { timeSinceLastUsed := time . Now ( ) . Sub ( usableKey . LastUsed ) if timeSinceLastUsed > keyUsageTime { configuration . UsableAPIKeys . APIKeys [ i ] . LastUsed = time . Now ( ) keyGetLock . Unlock ( ) return usableKey . Key } } time . Sleep ( time . Duration ( 3 ) * time . Millisecond ) } }
GetSteamAPIKey gets a steam API key.
GetSteamAPIKey gets a steam API key .