summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs
diff options
context:
space:
mode:
authorMarkus Duft <markus.duft@ssi-schaefer.com>2018-04-12 10:11:18 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2018-06-09 14:42:55 +0200
commita9e6da108212332e7dd476342090b77f9a72034e (patch)
tree9db5ec2819d08de57e2928447ee5f28d5c7c7ad1 /org.eclipse.jgit.lfs
parent62460b42b7a64513e3421aae17082fdc923faf95 (diff)
downloadjgit-a9e6da108212332e7dd476342090b77f9a72034e.tar.gz
jgit-a9e6da108212332e7dd476342090b77f9a72034e.zip
LFS: Better SSH authentication token timeout handling
* 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>
Diffstat (limited to 'org.eclipse.jgit.lfs')
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java
index 25a70c745a..3ac69923f2 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java
@@ -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)