From 6f4794ac17ae09341fec61eba6cad18b9a3c0026 Mon Sep 17 00:00:00 2001 From: jcarpe Date: Sat, 7 Jun 2025 08:34:49 -0400 Subject: [PATCH 1/2] fix broken xml in full gams list --- full-games-clz-list.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/full-games-clz-list.xml b/full-games-clz-list.xml index ec988eb..fcf7a5d 100644 --- a/full-games-clz-list.xml +++ b/full-games-clz-list.xml @@ -64313,4 +64313,5 @@ Yes Yes - \ No newline at end of file + + \ No newline at end of file From d9b0d41bf912866f05f725339200ea4f9234e20f Mon Sep 17 00:00:00 2001 From: jcarpe Date: Sat, 7 Jun 2025 08:35:02 -0400 Subject: [PATCH 2/2] fix rate limit sleep timer --- src/adapters/igdb/igdb.go | 6 ++++-- src/domain/clz-translation/translate.go | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/adapters/igdb/igdb.go b/src/adapters/igdb/igdb.go index ace162e..73c1c13 100644 --- a/src/adapters/igdb/igdb.go +++ b/src/adapters/igdb/igdb.go @@ -97,7 +97,7 @@ func fuzzyFindIGDBGameByTitle(title string, clzPlatformName string) int { // Search for the game by normalized title gamesData := fuzzySearchByTerm(normalizedTitle) if len(gamesData) == 0 { - fmt.Printf("No games found in FuzzyFind for title: %s\n", title) + fmt.Printf("FuzzyFind failed for title: %s\n", normalizedTitle) return 0 } @@ -146,10 +146,12 @@ func fuzzyFindGamesList(gameList []domain.Game) []domain.Game { fmt.Printf("Invalid IGDB_API_RATE_LIMIT value: %v -- setting to 0\n", err) rateLimit = 0 // Default to 0 second if parsing fails } - sleepTime := time.Duration(rateLimit) + + sleepTime := time.Duration(rateLimit) * time.Millisecond for i, game := range gameList { if i != 0 { + fmt.Printf("%d Sleeping for rate limit...\n", i) // Sleep for a short duration to avoid hitting the rate limit time.Sleep(sleepTime) } diff --git a/src/domain/clz-translation/translate.go b/src/domain/clz-translation/translate.go index fd1fe4c..5c66420 100644 --- a/src/domain/clz-translation/translate.go +++ b/src/domain/clz-translation/translate.go @@ -221,9 +221,9 @@ func TranslateCLZ(input string, igdbSupplement bool) domain.GameCollection { rateLimit, err := strconv.Atoi(rateLimitStr) if err != nil { fmt.Printf("Invalid IGDB_API_RATE_LIMIT value: %v\n", err) - rateLimit = 2000 // Default to 2000 second if parsing fails + rateLimit = 500 // default to 500 milliseconds if parsing fails } - sleepTime := time.Duration(rateLimit) + sleepTime := time.Duration(rateLimit) * time.Millisecond for _, batchQuery := range batchQueries { // retrieve IGDB data for each batch