Revision 8f31884...(Back to digest)
Optimization in KDE-PIM
Nepomuk Feeder: Siplify the concept of the ItemQueue
The ItemQueue is this slightly convuluted class that served as queue
whose function would be different in different circumstances.
It originally contained a list of items (mItemPipeline) which still needed
to be fetched from Akonadi, a list of fetched items - mFetchedItemList
and a few other lists - mItemFetchList and mTempFetchList (not really
required). The class's main function processItem would perform
differents functions -
* If an indexing operation is going on - nothing
* If it mItemFetchList does not contain enough items, it would move one
item from the mItemPipeline to the mItemFetch list
* If the mItemFetchList was long enough, it would fetch all those items
from AKonadi and store them in the mFetchedItemList and start
processing them, one batch at a time untill mFetchedItemList is empty
Overall, it was quite confusing. I think I might have even missed a case
or two in the description above.
With this patch the entire concept of the ItemQueue has been simplified,
and its functions have now been renamed, and unnecessary variables have
The ItemQueue is now just responsible for the following functions -
* Fetching Akonadi Items when required in mFetchSize multiples
* Indexing those fetched Akonadi Items in mBatchSize multiples
Each call to processBatch (previously called processItem), will send one
batch for indexing. That's it. If it doesn't have enough items in its
queue, it will fetch mFetchSize items from Akonadi and then send them
Because of this simplification, we had to remove the concept of
indexingDelay between batches. Each call now just processes one batch,
it is the callers responsibility to schedule them properly.
All the functions now also return sane return values. Earlier the
concept of true/false was little shaky.
Also added proper documentation to the class so that it is evident what
this is class is supposed to do.