From e29060fdea16375749bb65eb3dc67a970e254124 Mon Sep 17 00:00:00 2001 From: WarmUpTill <19472752+WarmUpTill@users.noreply.github.com> Date: Sun, 30 Nov 2025 12:23:29 +0100 Subject: [PATCH] Throttle Twitch API access for at least 1 second --- plugins/twitch/twitch-helpers.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/twitch/twitch-helpers.cpp b/plugins/twitch/twitch-helpers.cpp index 9fa241e1..496fc5be 100644 --- a/plugins/twitch/twitch-helpers.cpp +++ b/plugins/twitch/twitch-helpers.cpp @@ -144,9 +144,14 @@ static void handleThrottling(const httplib::Result &response) return; } - blog(LOG_WARNING, "Twitch API access is throttled for %lld seconds!", + if (sleepDuration < std::chrono::seconds(1)) { + sleepDuration = std::chrono::seconds(1); + } + + blog(LOG_WARNING, + "Twitch API access is throttled for %lld milliseconds!", static_cast( - std::chrono::duration_cast( + std::chrono::duration_cast( sleepDuration) .count())); apiIsThrottling = true;