[tracker] libtracker-miner: Process TrackerCrawler elements in batches
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-miner: Process TrackerCrawler elements in batches
- Date: Sun, 9 Jul 2017 22:12:38 +0000 (UTC)
commit 6266fe69e6b779bf0cc3a0abc957b9141a03d609
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Jul 7 22:07:12 2017 +0200
libtracker-miner: Process TrackerCrawler elements in batches
This prevents us from hitting too hard the main loop.
src/libtracker-miner/tracker-crawler.c | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-crawler.c b/src/libtracker-miner/tracker-crawler.c
index 122464e..3aeede4 100644
--- a/src/libtracker-miner/tracker-crawler.c
+++ b/src/libtracker-miner/tracker-crawler.c
@@ -39,6 +39,8 @@
*/
#define FILES_GROUP_SIZE 100
+#define MAX_SIMULTANEOUS_ITEMS 64
+
typedef struct DirectoryChildData DirectoryChildData;
typedef struct DirectoryProcessingData DirectoryProcessingData;
typedef struct DirectoryRootInfo DirectoryRootInfo;
@@ -587,15 +589,13 @@ directory_root_info_free (DirectoryRootInfo *info)
}
static gboolean
-process_func (gpointer data)
+process_next (TrackerCrawler *crawler)
{
- TrackerCrawler *crawler;
TrackerCrawlerPrivate *priv;
DirectoryRootInfo *info;
DirectoryProcessingData *dir_data = NULL;
gboolean stop_idle = FALSE;
- crawler = TRACKER_CRAWLER (data);
priv = crawler->priv;
if (priv->is_paused) {
@@ -703,6 +703,22 @@ process_func (gpointer data)
}
static gboolean
+process_func (gpointer data)
+{
+ TrackerCrawler *crawler = data;
+ gboolean retval = FALSE;
+ gint i;
+
+ for (i = 0; i < MAX_SIMULTANEOUS_ITEMS; i++) {
+ retval = process_next (crawler);
+ if (retval == FALSE)
+ break;
+ }
+
+ return retval;
+}
+
+static gboolean
process_func_start (TrackerCrawler *crawler)
{
if (crawler->priv->is_paused) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]