fix(eventsub): retry if the WS session expired (#6093)
This commit is contained in:
+1
-1
@@ -50,7 +50,7 @@
|
|||||||
- Bugfix: Fixed some windows not immediately closing. (#6054)
|
- Bugfix: Fixed some windows not immediately closing. (#6054)
|
||||||
- Bugfix: The emote button no longer looks crunchy. (#6080, #6085)
|
- 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: 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: Remove unneeded platform specifier for toasts. (#5914)
|
||||||
- Dev: Cleanly shutdown on `SIGINT`/`SIGTERM` on Linux & macOS. (#6053)
|
- Dev: Cleanly shutdown on `SIGINT`/`SIGTERM` on Linux & macOS. (#6053)
|
||||||
- Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784)
|
- Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784)
|
||||||
|
|||||||
@@ -3271,7 +3271,16 @@ void Helix::createEventSubSubscription(
|
|||||||
switch (*result.status())
|
switch (*result.status())
|
||||||
{
|
{
|
||||||
case 400: {
|
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;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -864,6 +864,7 @@ enum class HelixCreateEventSubSubscriptionError : std::uint8_t {
|
|||||||
Forbidden,
|
Forbidden,
|
||||||
Conflict,
|
Conflict,
|
||||||
Ratelimited,
|
Ratelimited,
|
||||||
|
NoSession,
|
||||||
|
|
||||||
// The error message is forwarded directly from the Twitch API
|
// The error message is forwarded directly from the Twitch API
|
||||||
Forwarded,
|
Forwarded,
|
||||||
|
|||||||
@@ -323,6 +323,8 @@ void Controller::subscribe(const SubscriptionRequest &request, bool isRetry)
|
|||||||
},
|
},
|
||||||
[this, request](const auto &error, const auto &errorString) {
|
[this, request](const auto &error, const auto &errorString) {
|
||||||
using Error = HelixCreateEventSubSubscriptionError;
|
using Error = HelixCreateEventSubSubscriptionError;
|
||||||
|
|
||||||
|
bool retry = false;
|
||||||
switch (error)
|
switch (error)
|
||||||
{
|
{
|
||||||
case Error::BadRequest:
|
case Error::BadRequest:
|
||||||
@@ -347,18 +349,31 @@ void Controller::subscribe(const SubscriptionRequest &request, bool isRetry)
|
|||||||
qCDebug(LOG) << "Ratelimited" << errorString << request;
|
qCDebug(LOG) << "Ratelimited" << errorString << request;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Error::NoSession:
|
||||||
|
qCDebug(LOG) << "Session expired, retrying"
|
||||||
|
<< errorString << request;
|
||||||
|
retry = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case Error::Forwarded:
|
case Error::Forwarded:
|
||||||
default:
|
default:
|
||||||
qCWarning(LOG) << "Unhandled error, retrying "
|
qCWarning(LOG) << "Unhandled error, retrying "
|
||||||
"subscription"
|
"subscription"
|
||||||
<< errorString << request;
|
<< errorString << request;
|
||||||
boost::asio::post(this->ioContext, [this, request] {
|
retry = true;
|
||||||
this->retrySubscription(request);
|
break;
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->markRequestFailed(request);
|
if (retry)
|
||||||
|
{
|
||||||
|
boost::asio::post(this->ioContext, [this, request] {
|
||||||
|
this->retrySubscription(request);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->markRequestFailed(request);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user