Skip to content

Commit

Permalink
Batch multicast into at most 50 resources per report.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.mulberrymail.com/mulberry/Mulberry/branches/v4.1d1@493 a91246af-f21b-0410-bd1c-c3c7fc455132
  • Loading branch information
cyrusdaboo authored and mbert committed Apr 17, 2015
1 parent 9282096 commit a88acbb
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions Sources_Common/Calendar_Store/Protocols/CCalendarProtocol.cpp
Expand Up @@ -1320,8 +1320,18 @@ bool CCalendarProtocol::SyncComponentsFromServerFast(const CCalendarStoreNode& n
rurls.push_back((*iter).first);
}

if (rurls.size() != 0)
mClient->_ReadComponents(node, cal, rurls);
while(rurls.size() != 0)
{
// Limit to at most 50 resources
cdstrvect rurls_batched;
while(rurls.size() != 0 and rurls_batched.size() < 50)
{
rurls_batched.push_back(rurls.back());
rurls.pop_back();
}

mClient->_ReadComponents(node, cal, rurls_batched);
}
}

// Clear out cache recording
Expand Down Expand Up @@ -1581,8 +1591,18 @@ bool CCalendarProtocol::SyncComponentsFromServerSlow(const CCalendarStoreNode& n
}

// Read components from server into local cache as its a new one on the server
if (rurls.size() != 0)
mClient->_ReadComponents(node, cal, rurls);
while(rurls.size() != 0)
{
// Limit to at most 50 resources
cdstrvect rurls_batched;
while(rurls.size() != 0 and rurls_batched.size() < 50)
{
rurls_batched.push_back(rurls.back());
rurls.pop_back();
}

mClient->_ReadComponents(node, cal, rurls_batched);
}
}

// Clear out cache recording
Expand Down

0 comments on commit a88acbb

Please sign in to comment.