[evolution-data-server] Bug #730398 - [WebDAV] Incorrect cache clean-up after book view cancel
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug #730398 - [WebDAV] Incorrect cache clean-up after book view cancel
- Date: Wed, 21 May 2014 14:53:50 +0000 (UTC)
commit 64a4042873e62ef06625afbf8ca3c17de1037fcc
Author: Milan Crha <mcrha redhat com>
Date: Wed May 21 16:51:40 2014 +0200
Bug #730398 - [WebDAV] Incorrect cache clean-up after book view cancel
.../backends/webdav/e-book-backend-webdav.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/addressbook/backends/webdav/e-book-backend-webdav.c
b/addressbook/backends/webdav/e-book-backend-webdav.c
index cc9c6a9..4402a9e 100644
--- a/addressbook/backends/webdav/e-book-backend-webdav.c
+++ b/addressbook/backends/webdav/e-book-backend-webdav.c
@@ -70,6 +70,8 @@ struct _EBookBackendWebdavPrivate {
gchar *username;
gchar *password;
gboolean supports_getctag;
+ gint64 last_server_test_us; /* real-time, in microseconds, when the last server test
+ for changes had been made, when the server doesn't support ctag */
GMutex cache_lock;
GMutex update_lock;
@@ -688,8 +690,17 @@ check_addressbook_changed (EBookBackendWebdav *webdav,
*new_ctag = NULL;
priv = webdav->priv;
- if (!priv->supports_getctag)
+ if (!priv->supports_getctag) {
+ gint64 real_time_us = g_get_real_time ();
+
+ /* Fifteen minutes in microseconds */
+ if (real_time_us - priv->last_server_test_us < 15 * 60 * 1000 * 1000)
+ return FALSE;
+
+ priv->last_server_test_us = real_time_us;
+
return TRUE;
+ }
priv->supports_getctag = FALSE;
@@ -1008,7 +1019,12 @@ download_contacts (EBookBackendWebdav *webdav,
e_data_book_view_notify_progress (book_view, -1, NULL);
g_mutex_lock (&priv->cache_lock);
- g_hash_table_foreach (href_to_contact, remove_unknown_contacts_cb, webdav);
+
+ if (!g_cancellable_is_cancelled (cancellable) &&
+ (!running || e_flag_is_set (running))) {
+ /* clean-up the cache only if it wasn't cancelled during the work */
+ g_hash_table_foreach (href_to_contact, remove_unknown_contacts_cb, webdav);
+ }
e_file_cache_thaw_changes (E_FILE_CACHE (priv->cache));
g_mutex_unlock (&priv->cache_lock);
g_mutex_unlock (&priv->update_lock);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]