PendingFileQueue: Implement proper backing off
Review Request #120333 - Created Sept. 23, 2014 and submitted
The PendingFileQueue is now handles multiple modification events much
better. It performs the following functions -
Take decissions on new file events as soon as possible. This is done
with a minor delay of 10 msecs to cache incoming successive events
Keep track of files which we have sent for indexing up to a predefined
amount of time. This value is called the trackingTime.
On receiving a file event for a file which is still being tracked,
wait between minTimeout and maxTimeout. Successive events when waiting
increase the timeout up to maxTimeout.
This patch is still not ideal because if we get cyclic events causing a write every 6 seconds, they will get queued wait for 5 seconds and then be sent. Ideally, there we should detect such cyclic events and delay those writes even more. However, if we delay them too long then the user may get frustrated and more importantly baloo might have to shutdown because the laptop is shutting down, and then the event will be lost.