Commit ff1e372f authored by Bartek Fabiszewski's avatar Bartek Fabiszewski
Browse files

Try to reauthorize immediately in case of expired session

parent 0ed05426
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -120,8 +120,16 @@ public class WebSyncService extends IntentService {
            } catch (WebAuthException e) {
                if (Logger.DEBUG) { Log.d(TAG, "[websync auth exception: " + e + "]"); }
                isAuthorized = false;
                try {
                    // reauthorize and retry
                    web.authorize();
                    isAuthorized = true;
                    trackId = web.startTrack(trackName);
                    db.setTrackId(trackId);
                } catch (WebAuthException|IOException|JSONException e2) {
                    // schedule retry
                handleError(e);
                    handleError(e2);
                }
            }
        }
        return trackId;
@@ -155,8 +163,15 @@ public class WebSyncService extends IntentService {
        } catch (WebAuthException e) {
            if (Logger.DEBUG) { Log.d(TAG, "[websync auth exception: " + e + "]"); }
            isAuthorized = false;
            try {
                // reauthorize and retry
                web.authorize();
                isAuthorized = true;
                doSync(trackId);
            } catch (WebAuthException|IOException|JSONException e2) {
                // schedule retry
            handleError(e);
                handleError(e2);
            }
        } finally {
            cursor.close();
        }