Commit bf6170c0 authored by Krzysztof Nowicki's avatar Krzysztof Nowicki Committed by Laurent Montel
Browse files

Don't enqueue multiple syncs of collection, which is being synced



Fix logic error that allowed queuing multiple syncs of the collection,
for which an active sync is ongoing. Instead the logic should only
allow to queue one additional sync besides the one currently in
operation.
Signed-off-by: Krzysztof Nowicki's avatarKrzysztof Nowicki <krissn@op.pl>
parent 81864271
......@@ -352,10 +352,11 @@ void EwsResource::queueFetchItemsJob(const Akonadi::Collection &col, std::functi
qCDebugNC(EWSRES_LOG) << QStringLiteral("Enqueuing sync for collection ") << col;
const auto queueEmpty = mFetchItemsJobQueue.empty();
if (!queueEmpty) {
for (const auto &item : std::as_const(mFetchItemsJobQueue)) {
// Don't enqueue the same collection twice, unless it's for the currently synced collection.
if (item.col != mFetchItemsJobQueue.head().col && item.col == col) {
if (mFetchItemsJobQueue.count() > 1) {
// Don't enqueue the same collection id, type pair twice, except for the first element,
// which belongs to the collection being synced right now.
for (const auto &item : std::as_const(mFetchItemsJobQueue).mid(1)) {
if ((item.col == col) && (item.type == type)) {
qCDebugNC(EWSRES_LOG) << QStringLiteral("Sync already queued - skipping");
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment