[polari/wip/carlosg/tracker: 5/13] log-tool: Push updates in batches
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/carlosg/tracker: 5/13] log-tool: Push updates in batches
- Date: Sun, 24 Feb 2019 22:58:59 +0000 (UTC)
commit f2cad8bbfc3c2a0d9c6875db8851de6c61501c98
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Feb 24 22:55:49 2019 +0100
log-tool: Push updates in batches
Allow a maximum of 500 elements to be pushed at once. Improves
abysmal performance when importing logs for those spam heavy days.
src/polari-log-tool.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/src/polari-log-tool.c b/src/polari-log-tool.c
index c33dc0a..2985ecc 100644
--- a/src/polari-log-tool.c
+++ b/src/polari-log-tool.c
@@ -42,6 +42,7 @@ import_ready (GObject *source,
GString *sparql = g_string_new (NULL);
char *account_id = NULL, *channel_name = NULL;
gboolean is_room;
+ int batch_count = 0;
messages = polari_tpl_importer_import_finish (importer,
result,
@@ -90,6 +91,17 @@ import_ready (GObject *source,
polari_message_get_sender (tpl_message),
polari_message_get_text (tpl_message));
#endif
+
+ batch_count++;
+
+ if (batch_count == 500)
+ {
+ tracker_sparql_connection_update (connection, sparql->str,
+ G_PRIORITY_DEFAULT, NULL, &error);
+ g_string_free (sparql, TRUE);
+ sparql = g_string_new (NULL);
+ batch_count = 0;
+ }
}
g_list_free_full (messages, (GDestroyNotify)polari_message_free);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]