37 lines
1.5 KiB
Diff
37 lines
1.5 KiB
Diff
|
--- camel/camel-folder-summary.c
|
||
|
+++ camel/camel-folder-summary.c
|
||
|
@@ -67,6 +67,7 @@
|
||
|
|
||
|
/* Make 5 minutes as default cache drop */
|
||
|
#define SUMMARY_CACHE_DROP 300
|
||
|
+#define dd(x) if (camel_debug("sync")) x
|
||
|
|
||
|
static pthread_mutex_t info_lock = PTHREAD_MUTEX_INITIALIZER;
|
||
|
|
||
|
@@ -823,12 +824,13 @@ remove_cache (CamelSession *session, CamelSessionThreadMsg *msg)
|
||
|
CamelFolderSummary *s = m->summary;
|
||
|
|
||
|
CAMEL_DB_RELEASE_SQLITE_MEMORY;
|
||
|
-
|
||
|
+ camel_folder_sync (s->folder, FALSE, NULL);
|
||
|
+
|
||
|
if (time(NULL) - s->cache_load_time < SUMMARY_CACHE_DROP)
|
||
|
return;
|
||
|
|
||
|
- d(printf("removing cache for %s %d %p\n", s->folder ? s->folder->full_name : s->summary_path, g_hash_table_size (s->loaded_infos), s->loaded_infos));
|
||
|
- #warning "hack. fix it"
|
||
|
+ dd(printf("removing cache for %s %d %p\n", s->folder ? s->folder->full_name : s->summary_path, g_hash_table_size (s->loaded_infos), s->loaded_infos));
|
||
|
+
|
||
|
CAMEL_SUMMARY_LOCK (s, summary_lock);
|
||
|
g_hash_table_foreach_remove (s->loaded_infos, (GHRFunc) remove_item, s);
|
||
|
CAMEL_SUMMARY_UNLOCK (s, summary_lock);
|
||
|
@@ -1378,7 +1380,7 @@ camel_folder_summary_save_to_db (CamelFolderSummary *s, CamelException *ex)
|
||
|
if (!count)
|
||
|
return camel_folder_summary_header_save_to_db (s, ex);
|
||
|
|
||
|
- d(printf("Saving %d/%d dirty records of %s\n", count, g_hash_table_size (s->loaded_infos), s->folder->full_name));
|
||
|
+ dd(printf("Saving %d/%d dirty records of %s\n", count, g_hash_table_size (s->loaded_infos), s->folder->full_name));
|
||
|
|
||
|
camel_db_begin_transaction (cdb, ex);
|
||
|
|