[tracker-miners/wip/carlosg/batches-and-resources: 12/31] libtracker-miner: Avoid repeatedly stopping the extraction timer
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/batches-and-resources: 12/31] libtracker-miner: Avoid repeatedly stopping the extraction timer
- Date: Fri, 11 Dec 2020 10:55:03 +0000 (UTC)
commit 644f1004f78be988b3694bcdd3bdaa2469113359
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Dec 5 14:19:13 2020 +0100
libtracker-miner: Avoid repeatedly stopping the extraction timer
Calling g_timer_stop() repeatedly, simply resets the stop time,
this has the curious side effect that g_timer_elapsed() returns
time as if it was never stopped till the last stop call.
Since the start time is initialization time, we account all of
it into the file processing phase, skewing remaining time
estimations.
Avoid stopping the timer multiple times, so elapsed time is
accounted correctly, and remaining time estimations are more
accurate.
src/libtracker-miner/tracker-miner-fs.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index 95e27b491..16c6be251 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -1508,7 +1508,8 @@ item_queue_get_next_file (TrackerMinerFS *fs,
if (tracker_file_notifier_is_active (fs->priv->file_notifier) ||
tracker_task_pool_limit_reached (fs->priv->task_pool) ||
tracker_task_pool_limit_reached (TRACKER_TASK_POOL (fs->priv->sparql_buffer))) {
- if (tracker_task_pool_get_size (fs->priv->task_pool) == 0) {
+ if (!fs->priv->extraction_timer_stopped &&
+ tracker_task_pool_get_size (fs->priv->task_pool) == 0) {
fs->priv->extraction_timer_stopped = TRUE;
g_timer_stop (fs->priv->extraction_timer);
}
@@ -1638,10 +1639,10 @@ miner_handle_next_item (TrackerMinerFS *fs)
return FALSE;
}
- if (file == NULL) {
+ if (file == NULL && !fs->priv->extraction_timer_stopped) {
g_timer_stop (fs->priv->extraction_timer);
fs->priv->extraction_timer_stopped = TRUE;
- } else if (fs->priv->extraction_timer_stopped) {
+ } else if (file != NULL && fs->priv->extraction_timer_stopped) {
g_timer_continue (fs->priv->extraction_timer);
fs->priv->extraction_timer_stopped = FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]