]> source.dussan.org Git - jgit.git/commitdiff
LFS: Better SSH authentication token timeout handling 88/124288/2
authorMarkus Duft <markus.duft@ssi-schaefer.com>
Thu, 12 Apr 2018 08:11:18 +0000 (10:11 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Sat, 9 Jun 2018 12:42:55 +0000 (14:42 +0200)
 * Larger eager timeout to compensate for high-latency lines
 * Respect eager timeout in case the server uses "expiresIn"

Change-Id: Id87da1eea874e70b69eaccf35c84af4c3bb50770
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java

index 25a70c745ae17b4fa3efacea40373f8b2e033b42..3ac69923f239de2d53f9ea31e6e49ae83e496df8 100644 (file)
@@ -273,7 +273,7 @@ public class LfsConnectionFactory {
        }
 
        private static final class AuthCache {
-               private static final long AUTH_CACHE_EAGER_TIMEOUT = 100;
+               private static final long AUTH_CACHE_EAGER_TIMEOUT = 500;
 
                private static final SimpleDateFormat ISO_FORMAT = new SimpleDateFormat(
                                "yyyy-MM-dd'T'HH:mm:ss.SSSX"); //$NON-NLS-1$
@@ -290,8 +290,9 @@ public class LfsConnectionFactory {
                        this.cachedAction = action;
                        try {
                                if (action.expiresIn != null && !action.expiresIn.isEmpty()) {
-                                       this.validUntil = System.currentTimeMillis()
-                                                       + Long.parseLong(action.expiresIn);
+                                       this.validUntil = (System.currentTimeMillis()
+                                                       + Long.parseLong(action.expiresIn))
+                                                       - AUTH_CACHE_EAGER_TIMEOUT;
                                } else if (action.expiresAt != null
                                                && !action.expiresAt.isEmpty()) {
                                        this.validUntil = ISO_FORMAT.parse(action.expiresAt)