diff --git a/CHANGELOG.md b/CHANGELOG.md index c172baf8..68c294b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,7 +50,7 @@ - Bugfix: Fixed some windows not immediately closing. (#6054) - Bugfix: The emote button no longer looks crunchy. (#6080, #6085) - Dev: Subscriptions to PubSub channel points redemption topics now use no auth token, making it continue to work during PubSub shutdown. (#5947) -- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943, #5952, #5953, #5968, #5973, #5974, #5980, #5981, #5985, #5990, #5992, #5993, #5996, #5995, #6000, #6001, #6002, #6003, #6005, #6007, #6010, #6008, #6012, #6013, #6015, #6017, #6027, #6028, #6035, #6036, #6040, #6041, #6048, #6058, #6059, #6078, #6079, #6086, #6092) +- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943, #5952, #5953, #5968, #5973, #5974, #5980, #5981, #5985, #5990, #5992, #5993, #5996, #5995, #6000, #6001, #6002, #6003, #6005, #6007, #6010, #6008, #6012, #6013, #6015, #6017, #6027, #6028, #6035, #6036, #6040, #6041, #6048, #6058, #6059, #6078, #6079, #6086, #6092, #6093) - Dev: Remove unneeded platform specifier for toasts. (#5914) - Dev: Cleanly shutdown on `SIGINT`/`SIGTERM` on Linux & macOS. (#6053) - Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784) diff --git a/src/providers/twitch/api/Helix.cpp b/src/providers/twitch/api/Helix.cpp index ca92588b..72ba887f 100644 --- a/src/providers/twitch/api/Helix.cpp +++ b/src/providers/twitch/api/Helix.cpp @@ -3271,7 +3271,16 @@ void Helix::createEventSubSubscription( switch (*result.status()) { case 400: { - failureCallback(Error::BadRequest, message); + if (message.startsWith( + "websocket transport session does not exist", + Qt::CaseInsensitive)) + { + failureCallback(Error::NoSession, message); + } + else + { + failureCallback(Error::BadRequest, message); + } } break; diff --git a/src/providers/twitch/api/Helix.hpp b/src/providers/twitch/api/Helix.hpp index 8298a520..2b58fdb3 100644 --- a/src/providers/twitch/api/Helix.hpp +++ b/src/providers/twitch/api/Helix.hpp @@ -864,6 +864,7 @@ enum class HelixCreateEventSubSubscriptionError : std::uint8_t { Forbidden, Conflict, Ratelimited, + NoSession, // The error message is forwarded directly from the Twitch API Forwarded, diff --git a/src/providers/twitch/eventsub/Controller.cpp b/src/providers/twitch/eventsub/Controller.cpp index 12a192a2..f755b6c1 100644 --- a/src/providers/twitch/eventsub/Controller.cpp +++ b/src/providers/twitch/eventsub/Controller.cpp @@ -323,6 +323,8 @@ void Controller::subscribe(const SubscriptionRequest &request, bool isRetry) }, [this, request](const auto &error, const auto &errorString) { using Error = HelixCreateEventSubSubscriptionError; + + bool retry = false; switch (error) { case Error::BadRequest: @@ -347,18 +349,31 @@ void Controller::subscribe(const SubscriptionRequest &request, bool isRetry) qCDebug(LOG) << "Ratelimited" << errorString << request; break; + case Error::NoSession: + qCDebug(LOG) << "Session expired, retrying" + << errorString << request; + retry = true; + break; + case Error::Forwarded: default: qCWarning(LOG) << "Unhandled error, retrying " "subscription" << errorString << request; - boost::asio::post(this->ioContext, [this, request] { - this->retrySubscription(request); - }); - return; + retry = true; + break; } - this->markRequestFailed(request); + if (retry) + { + boost::asio::post(this->ioContext, [this, request] { + this->retrySubscription(request); + }); + } + else + { + this->markRequestFailed(request); + } }); return;