From 56b1fd6913e00394560c15442ba4d74bfe02d4cc Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Thu, 20 Sep 2018 13:39:19 +0200 Subject: [PATCH] Increase timeout on FFZ channel emote requests We might want to send some message upon these sort of errors happening Fix #709 --- src/providers/ffz/FfzEmotes.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/providers/ffz/FfzEmotes.cpp b/src/providers/ffz/FfzEmotes.cpp index eb6912ff7..a718eb705 100644 --- a/src/providers/ffz/FfzEmotes.cpp +++ b/src/providers/ffz/FfzEmotes.cpp @@ -152,7 +152,7 @@ void FfzEmotes::loadChannel(const QString &channelName, NetworkRequest request("https://api.frankerfacez.com/v1/room/" + channelName); request.setCaller(QThread::currentThread()); - request.setTimeout(3000); + request.setTimeout(20000); request.onSuccess([callback = std::move(callback)](auto result) -> Outcome { auto pair = parseChannelEmotes(result.parseJson()); @@ -160,6 +160,25 @@ void FfzEmotes::loadChannel(const QString &channelName, return pair.first; }); + request.onError([channelName](int result) { + if (result == 203) { + // User does not have any FFZ emotes + return true; + } + + if (result == -2) { + // TODO: Auto retry in case of a timeout, with a delay + log("Fetching FFZ emotes for channel {} failed due to timeout", + channelName); + return true; + } + + log("Error fetching FFZ emotes for channel {}, error {}", channelName, + result); + + return true; + }); + request.execute(); }