From 01fcb1961a560d9d15b8d0979b1116f6560d3db5 Mon Sep 17 00:00:00 2001 From: Anatoli Kurtsevich Date: Tue, 22 Aug 2023 11:28:36 -0400 Subject: [PATCH] Updated token renewal strategy to ask for a new token if the existing one expires in next 60 sec (#43) --- rai-sdk/src/main/java/com/relationalai/AccessToken.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rai-sdk/src/main/java/com/relationalai/AccessToken.java b/rai-sdk/src/main/java/com/relationalai/AccessToken.java index deaa3065..cf020049 100644 --- a/rai-sdk/src/main/java/com/relationalai/AccessToken.java +++ b/rai-sdk/src/main/java/com/relationalai/AccessToken.java @@ -43,8 +43,8 @@ long nowEpochSecs() { } // Answers if the token is expired. - // Anticipate access token expiration by 5 seconds + // Anticipate access token expiration by 60 seconds public boolean isExpired() { - return nowEpochSecs() > expiresOn() - 5; + return nowEpochSecs() > expiresOn() - 60; } }