[QML] Set the remaining time in the monitor more reliably
ClosedPublic

Authored by bruns on Tue, Mar 24, 9:28 PM.

Details

Summary

The remaining time was only updated when the count of indexed files
modulo 100 is 0. I.e. if already 1295 files are indexed, and 90 of these
files are changed the indexed count goes down to 1205 and the update
is never triggered.

Use a QElapsedTimer to update the time when the file count changes, but
at most once per second.

Test Plan

Before:
Check the "Total files indexed" from balooctl status
Touch some large files (so the indexed count does not cross xx00)
The "remaining time" in kinfocenter is not updated

After:
The remaining time is updated after ~1 second.

Diff Detail

Repository
R293 Baloo
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bruns created this revision.Tue, Mar 24, 9:28 PM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptTue, Mar 24, 9:28 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
bruns requested review of this revision.Tue, Mar 24, 9:28 PM

Much nicer! Should the timer be destroyed when indexing is finished, though?

Much nicer! Should the timer be destroyed when indexing is finished, though?

QElapsedTimer is basically a timestamp with is updated on {re}start(). So we have to start it at least once, and reset it on elapsed() > 1s. Everything else does not matter much.

For the remaining time to be really updated once per second (not only once per batch=40), this also needs D28258, D28267

ngraham accepted this revision.Wed, Mar 25, 4:14 PM

Thanks for the explanation.

This revision is now accepted and ready to land.Wed, Mar 25, 4:14 PM
This revision was automatically updated to reflect the committed changes.