Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7246246d authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

add extra log to catch sync issue exception

parent 71e21495
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import java.util.logging.Level

object Logger : SharedPreferences.OnSharedPreferenceChangeListener {

    const val LOGGER_NAME = "davx5"
    const val LOGGER_NAME = "AccountManager"
    private const val LOG_TO_FILE = "log_to_file"

    val log: java.util.logging.Logger = java.util.logging.Logger.getLogger(LOGGER_NAME)
+4 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ abstract class SyncManager<ResourceType: LocalResource<*>, out CollectionType: L
     * @param maxRetryTime optional param, in seconds. On unhandled exception, max time the method should retry.
     */
    fun performSync(retryAfter: Int = Int.MIN_VALUE, secondRetryAfter: Int = Int.MIN_VALUE, maxRetryTime: Int = Int.MIN_VALUE) {
        Logger.log.log(Level.SEVERE, "performSync called for ${this.javaClass.simpleName}")
        // dismiss previous error notifications
        notificationManager.cancel(notificationTag, NotificationUtils.NOTIFY_SYNC_ERROR)

@@ -268,6 +269,7 @@ abstract class SyncManager<ResourceType: LocalResource<*>, out CollectionType: L
            else
                Logger.log.info("Remote collection didn't change, no reason to sync")
        }, { e, local, remote ->
            Logger.log.log(Level.SEVERE, "performSync faced exception for ${this.javaClass.simpleName}", e)
            when (e) {
                // sync was cancelled or account has been removed: re-throw to SyncAdapterService
                is InterruptedException,
@@ -318,6 +320,8 @@ abstract class SyncManager<ResourceType: LocalResource<*>, out CollectionType: L

            }
        })

        Logger.log.log(Level.SEVERE, "performSync ended for ${this.javaClass.simpleName}")
    }

    private fun retrySyncOperation(retryAfter: Int, secondRetryAfter: Int, maxRetryTime: Int, e: Throwable): Boolean {