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

Optimize item changes addition for chunked jobs


Signed-off-by: Krzysztof Nowicki's avatarKrzysztof Nowicki <krissn@op.pl>
parent 46ebb2e8
......@@ -129,6 +129,14 @@ public:
mChanges.append(change);
}
void addItemChanges(ItemChange::List::const_iterator firstChange, ItemChange::List::const_iterator lastChange)
{
mChanges.reserve(mChanges.size() + lastChange - firstChange);
for (auto it = firstChange; it != lastChange; ++it) {
mChanges.append(*it);
}
}
void setMessageDisposition(EwsMessageDisposition disp)
{
mMessageDisp = disp;
......
......@@ -63,9 +63,7 @@ void EwsModifyMailJob::start()
mChunkedJob.start(
[this](EwsUpdateItemRequest::ItemChange::List::const_iterator firstChange, EwsUpdateItemRequest::ItemChange::List::const_iterator lastChange) {
auto req = new EwsUpdateItemRequest(mClient, this);
for (auto it = firstChange; it != lastChange; ++it) {
req->addItemChange(*it);
}
req->addItemChanges(firstChange, lastChange);
return req;
},
[](EwsUpdateItemRequest *req) {
......
......@@ -136,9 +136,7 @@ void EwsUpdateItemsTagsJob::doUpdateItemsTags()
mChunkedJob.start(
[this](EwsUpdateItemRequest::ItemChange::List::const_iterator firstChange, EwsUpdateItemRequest::ItemChange::List::const_iterator lastChange) {
auto req = new EwsUpdateItemRequest(mClient, this);
for (auto it = firstChange; it != lastChange; ++it) {
req->addItemChange(*it);
}
req->addItemChanges(firstChange, lastChange);
return req;
},
[](EwsUpdateItemRequest *req) {
......
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