mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
parent
2f568b88ae
commit
5512437f1b
2 changed files with 6 additions and 5 deletions
|
@ -37,8 +37,6 @@ void IvrApi::getBulkEmoteSets(QString emoteSetList,
|
||||||
ResultCallback<QJsonArray> successCallback,
|
ResultCallback<QJsonArray> successCallback,
|
||||||
IvrFailureCallback failureCallback)
|
IvrFailureCallback failureCallback)
|
||||||
{
|
{
|
||||||
assert(!emoteSetList.isEmpty());
|
|
||||||
|
|
||||||
QUrlQuery urlQuery;
|
QUrlQuery urlQuery;
|
||||||
urlQuery.addQueryItem("set_id", emoteSetList);
|
urlQuery.addQueryItem("set_id", emoteSetList);
|
||||||
|
|
||||||
|
|
|
@ -307,13 +307,16 @@ void TwitchAccount::loadUserstateEmotes(QStringList emoteSetKeys)
|
||||||
constexpr int batchSize = 100;
|
constexpr int batchSize = 100;
|
||||||
|
|
||||||
std::vector<QStringList> batches;
|
std::vector<QStringList> batches;
|
||||||
|
int batchCount = (newEmoteSetKeys.size() / batchSize) + 1;
|
||||||
|
|
||||||
batches.reserve((newEmoteSetKeys.size() + 1) / batchSize);
|
batches.reserve(batchCount);
|
||||||
|
|
||||||
for (int i = 0; i < newEmoteSetKeys.size(); i += batchSize)
|
for (int i = 0; i < batchCount; i++)
|
||||||
{
|
{
|
||||||
QStringList batch;
|
QStringList batch;
|
||||||
for (int j = batchSize * i; j < batchSize; j++)
|
|
||||||
|
int last = std::min(batchSize, newEmoteSetKeys.size() - batchSize * i);
|
||||||
|
for (int j = batchSize * i; j < last; j++)
|
||||||
{
|
{
|
||||||
batch.push_back(newEmoteSetKeys.at(j));
|
batch.push_back(newEmoteSetKeys.at(j));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue