[evolution-data-server] Harden retrieving recurrence objects if calendar is busy



commit 692aa504aefdf60f923e253fbd40d32d29a6cb12
Author: Tobias Mueller <tobiasmue gnome org>
Date:   Thu May 28 00:25:15 2009 +0200

    Harden retrieving recurrence objects if calendar is busy
    
    Try ten times, before bailing out.
    Fixes bug 580724.
---
 calendar/libecal/e-cal.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index 9612e13..6ddb75a 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -3542,8 +3542,23 @@ generate_instances (ECal *ecal, time_t start, time_t end, const char *uid,
 
 	/* Generate objects */
 	if (uid && *uid) {
-		if (!e_cal_get_objects_for_uid (ecal, uid, &objects, NULL))
+		GError *error = NULL;
+		gint tries = 0;
+
+try_again:
+		if (!e_cal_get_objects_for_uid (ecal, uid, &objects, &error)) {
+			if (error->code == E_CALENDAR_STATUS_BUSY && tries >= 10) {
+				tries++;
+				g_usleep (500);
+				g_clear_error (&error);
+
+				goto try_again;
+			}
+
+			g_message ("Failed to get recurrence objects for uid %s \n", error->message);
+			g_clear_error (&error);
 			return;
+		}
 	}
 	else {
 		iso_start = isodate_from_time_t (start);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]