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

Authored by bruns on Mar 24 2020, 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.Mar 24 2020, 9:28 PM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptMar 24 2020, 9:28 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
bruns requested review of this revision.Mar 24 2020, 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.Mar 25 2020, 4:14 PM

Thanks for the explanation.

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