1
0
mirror of https://github.com/etesync/android synced 2024-11-15 12:28:57 +00:00

Don't pop notifications for serviceunavailable errors.

This commit is contained in:
Tom Hacohen 2017-02-20 19:29:53 +00:00
parent 942276284e
commit 09196e52a5
3 changed files with 7 additions and 0 deletions

View File

@ -79,6 +79,9 @@ public class CalendarsSyncAdapterService extends SyncAdapterService {
CalendarSyncManager syncManager = new CalendarSyncManager(getContext(), account, settings, extras, authority, syncResult, calendar, principal); CalendarSyncManager syncManager = new CalendarSyncManager(getContext(), account, settings, extras, authority, syncResult, calendar, principal);
syncManager.performSync(); syncManager.performSync();
} }
} catch (Exceptions.ServiceUnavailableException e) {
syncResult.stats.numIoExceptions++;
syncResult.delayUntil = (e.retryAfter > 0) ? e.retryAfter : Constants.DEFAULT_RETRY_DELAY;
} catch (Exception | OutOfMemoryError e) { } catch (Exception | OutOfMemoryError e) {
if (e instanceof CalendarStorageException || e instanceof SQLiteException) { if (e instanceof CalendarStorageException || e instanceof SQLiteException) {
App.log.log(Level.SEVERE, "Couldn't prepare local calendars", e); App.log.log(Level.SEVERE, "Couldn't prepare local calendars", e);

View File

@ -80,6 +80,9 @@ public class ContactsSyncAdapterService extends SyncAdapterService {
} }
} else } else
App.log.info("No CardDAV service found in DB"); App.log.info("No CardDAV service found in DB");
} catch (Exceptions.ServiceUnavailableException e) {
syncResult.stats.numIoExceptions++;
syncResult.delayUntil = (e.retryAfter > 0) ? e.retryAfter : Constants.DEFAULT_RETRY_DELAY;
} catch (Exception | OutOfMemoryError e) { } catch (Exception | OutOfMemoryError e) {
String syncPhase = SyncManager.SYNC_PHASE_JOURNALS; String syncPhase = SyncManager.SYNC_PHASE_JOURNALS;
String title = getContext().getString(R.string.sync_error_contacts, account.name); String title = getContext().getString(R.string.sync_error_contacts, account.name);

View File

@ -183,6 +183,7 @@ abstract public class SyncManager {
App.log.log(Level.WARNING, "I/O exception during sync, trying again later", e); App.log.log(Level.WARNING, "I/O exception during sync, trying again later", e);
syncResult.stats.numIoExceptions++; syncResult.stats.numIoExceptions++;
} catch (Exceptions.ServiceUnavailableException e) { } catch (Exceptions.ServiceUnavailableException e) {
syncResult.stats.numIoExceptions++;
syncResult.delayUntil = (e.retryAfter > 0) ? e.retryAfter : Constants.DEFAULT_RETRY_DELAY; syncResult.delayUntil = (e.retryAfter > 0) ? e.retryAfter : Constants.DEFAULT_RETRY_DELAY;
} catch (InterruptedException e) { } catch (InterruptedException e) {