[evolution-data-server] BUGFIX: #564388 - UI blocks for a long time when downloading mails with
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: svn-commits-list gnome org
- Subject: [evolution-data-server] BUGFIX: #564388 - UI blocks for a long time when downloading mails with
- Date: Mon, 13 Jul 2009 05:18:41 +0000 (UTC)
commit 4e4b1531ec4c3e2a17fabd26b93533053d751ea7
Author: Srinivasa Ragavan <sragavan novell com>
Date: Mon Jul 13 10:47:27 2009 +0530
BUGFIX: #564388 - UI blocks for a long time when downloading mails with
NNTP
Do the summary over transactions than individual commits.
camel/providers/nntp/camel-nntp-summary.c | 21 +++++++++++++++------
camel/providers/nntp/camel-nntp-utils.c | 12 ++++++++++--
2 files changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/camel/providers/nntp/camel-nntp-summary.c b/camel/providers/nntp/camel-nntp-summary.c
index cea1f2b..4ec87af 100644
--- a/camel/providers/nntp/camel-nntp-summary.c
+++ b/camel/providers/nntp/camel-nntp-summary.c
@@ -264,8 +264,10 @@ add_range_xover(CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint
gint ret;
guint n, count, total, size;
struct _xover_header *xover;
+ GHashTable *summary_table;
s = (CamelFolderSummary *)cns;
+ summary_table = camel_folder_summary_get_hashtable(s);
camel_operation_start(NULL, _("%s: Scanning new messages"), ((CamelService *)store)->url->host);
@@ -322,7 +324,7 @@ add_range_xover(CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint
/* truncated line? ignore? */
if (xover == NULL) {
- if (!camel_folder_summary_check_uid (s, cns->priv->uid)) {
+ if (!GPOINTER_TO_INT(g_hash_table_lookup (summary_table, cns->priv->uid))) {
mi = (CamelMessageInfoBase *)camel_folder_summary_add_from_header(s, headers);
if (mi) {
mi->size = size;
@@ -342,6 +344,8 @@ add_range_xover(CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint
camel_operation_end(NULL);
+ camel_folder_summary_free_hashtable(summary_table);
+
return ret;
}
@@ -355,9 +359,12 @@ add_range_head(CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint l
guint i, n, count, total;
CamelMessageInfo *mi;
CamelMimeParser *mp;
+ GHashTable *summary_table;
s = (CamelFolderSummary *)cns;
+ summary_table = camel_folder_summary_get_hashtable(s);
+
mp = camel_mime_parser_new();
camel_operation_start(NULL, _("%s: Scanning new messages"), ((CamelService *)store)->url->host);
@@ -386,7 +393,7 @@ add_range_head(CamelNNTPSummary *cns, CamelNNTPStore *store, guint high, guint l
if ((msgid = strchr(line, '<')) && (line = strchr(msgid+1, '>'))){
line[1] = 0;
cns->priv->uid = g_strdup_printf("%u,%s\n", n, msgid);
- if (!camel_folder_summary_check_uid (s, cns->priv->uid)) {
+ if (!GPOINTER_TO_INT(g_hash_table_lookup (summary_table, cns->priv->uid))) {
if (camel_mime_parser_init_with_stream(mp, (CamelStream *)store->stream) == -1)
goto error;
mi = camel_folder_summary_add_from_parser(s, mp);
@@ -424,6 +431,8 @@ ioerror:
camel_operation_end(NULL);
+ camel_folder_summary_free_hashtable(summary_table);
+
return ret;
}
@@ -495,6 +504,10 @@ camel_nntp_summary_check(CamelNNTPSummary *cns, CamelNNTPStore *store, gchar *li
cns->low = f;
}
+ camel_db_delete_uids (s->folder->parent_store->cdb_w, s->folder->full_name, del, ex);
+ g_slist_foreach (del, (GFunc) g_free, NULL);
+ g_slist_free (del);
+
if (cns->high < l) {
if (cns->high < f)
cns->high = f-1;
@@ -506,10 +519,6 @@ camel_nntp_summary_check(CamelNNTPSummary *cns, CamelNNTPStore *store, gchar *li
}
}
- camel_db_delete_uids (s->folder->parent_store->cdb_w, s->folder->full_name, del, ex);
- g_slist_foreach (del, (GFunc) g_free, NULL);
- g_slist_free (del);
-
/* TODO: not from here */
camel_folder_summary_touch(s);
camel_folder_summary_save_to_db (s, ex);
diff --git a/camel/providers/nntp/camel-nntp-utils.c b/camel/providers/nntp/camel-nntp-utils.c
index b325267..8f12405 100644
--- a/camel/providers/nntp/camel-nntp-utils.c
+++ b/camel/providers/nntp/camel-nntp-utils.c
@@ -266,14 +266,22 @@ camel_nntp_get_headers (CamelStore *store,
i = camel_folder_summary_count(folder->summary);
if(i != 0) {
+ GSList *del = NULL;
last_summary = uid_num(folder->summary, i-1);
if(last_summary < first_message)
camel_folder_summary_clear(folder->summary);
else {
- while(uid_num(folder->summary, 0) < first_message)
- camel_folder_summary_remove_index(folder->summary, 0);
+ while(uid_num(folder->summary, 0) < first_message) {
+ char *uid = camel_folder_summary_uid_from_index (folder->summary, 0);
+ del = g_slist_prepend (del, uid);
+ camel_folder_summary_remove_index_fast (s, 0);
+ }
+ camel_db_delete_uids (folder->parent_store->cdb_w, folder->full_name, del, ex);
+ g_slist_foreach (del, (GFunc) g_free, NULL);
+ g_slist_free (del);
+
if(last_summary >= last_message)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]