Increase timeout on FFZ channel emote requests

We might want to send some message upon these sort of errors happening

Fix #709
This commit is contained in:
Rasmus Karlsson 2018-09-20 13:39:19 +02:00
parent 8eba7a0182
commit 56b1fd6913

View file

@ -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();
}