[polari/wip/carlosg/tracker: 9/16] log-tool: Push updates in batches
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/carlosg/tracker: 9/16] log-tool: Push updates in batches
- Date: Sun, 24 Feb 2019 22:51:05 +0000 (UTC)
commit 075252166af1b204d6e0be2c0cbfa964c6fb3ff7
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]