rickstaa/crypto-listings-sniper

Fix incorrect warning log code

rickstaa opened this issue · 2 comments

The binanceListingsChecker contains code that is not correct:

blc.lastAssetsCheckTime = time.Now()
// Retrieve listing prices from Binance.
priceService := blc.BinanceClient.NewListPricesService()
listingPrices, err := priceService.Do(context.Background())
assets = make([]string, len(listingPrices))
// Log warning if failed.
if time.Since(blc.lastAssetsCheckTime) > time.Minute { // Only log every minute.
log.Printf("WARNING: Error retrieving Binance listing prices: %v", err)
blc.lastAssetsCheckTime = time.Now()
}

Here, the warning rate limit variable gets reset every time, while it should only be reset on the first trigger and after 1 minute.