From f292d2e097b55c2fdf72e4efeae9da771465e7d2 Mon Sep 17 00:00:00 2001 From: fourtf Date: Tue, 23 Jan 2018 21:40:51 +0100 Subject: [PATCH] fixed live status being cached --- src/singletons/resourcemanager.cpp | 2 +- src/twitch/twitchchannel.cpp | 2 +- src/util/urlfetch.hpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/singletons/resourcemanager.cpp b/src/singletons/resourcemanager.cpp index 4383d8f14..6add6bc05 100644 --- a/src/singletons/resourcemanager.cpp +++ b/src/singletons/resourcemanager.cpp @@ -345,7 +345,7 @@ void ResourceManager::loadChannelData(const QString &roomID, bool bypassCache) QString cheermoteURL = "https://api.twitch.tv/kraken/bits/actions?channel_id=" + roomID; util::twitch::get2( - cheermoteURL, QThread::currentThread(), [this, roomID](const rapidjson::Document &d) { + cheermoteURL, QThread::currentThread(), true, [this, roomID](const rapidjson::Document &d) { ResourceManager::Channel &ch = this->channels[roomID]; ParseCheermoteSets(ch.jsonCheermoteSets, d); diff --git a/src/twitch/twitchchannel.cpp b/src/twitch/twitchchannel.cpp index 37f15c04b..ef998b88b 100644 --- a/src/twitch/twitchchannel.cpp +++ b/src/twitch/twitchchannel.cpp @@ -156,7 +156,7 @@ void TwitchChannel::refreshLiveStatus() std::weak_ptr weak = this->shared_from_this(); - util::twitch::get2(url, QThread::currentThread(), [weak](const rapidjson::Document &d) { + util::twitch::get2(url, QThread::currentThread(), false, [weak](const rapidjson::Document &d) { SharedChannel shared = weak.lock(); if (!shared) { diff --git a/src/util/urlfetch.hpp b/src/util/urlfetch.hpp index b590df3f6..cd83e7c2d 100644 --- a/src/util/urlfetch.hpp +++ b/src/util/urlfetch.hpp @@ -37,14 +37,14 @@ static void get(QString url, const QObject *caller, }); } -static void get2(QString url, const QObject *caller, +static void get2(QString url, const QObject *caller, bool useQuickLoadCache, std::function successCallback) { util::NetworkRequest req(url); req.setCaller(caller); req.setRawHeader("Client-ID", getDefaultClientID()); req.setRawHeader("Accept", "application/vnd.twitchtv.v5+json"); - req.setUseQuickLoadCache(true); + req.setUseQuickLoadCache(useQuickLoadCache); req.getJSON2([=](const rapidjson::Document &document) { successCallback(document); //