Skip to content

Commit

Permalink
Use const for refresh period setup
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Aufart <[email protected]>
  • Loading branch information
aufi committed Jun 4, 2024
1 parent c1bad37 commit cb1fa02
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hack/tool/tackle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ args = parser.parse_args()

EXPORT_MANIFEST_FILENAME = "_manifest"
KNOWN_CRYPT_STRING = "tackle-cli-known-string-plaintext"
TOKEN_REFRESH_SECONDS = 240 # 4 minutes to refresh auth token

###############################################################################

Expand Down Expand Up @@ -162,7 +163,7 @@ class TackleTool:
self.Url = tackle2Url
# Gather Keycloak access token for Tackle
self.Token = getHubToken(tackle2Url, c['username'], c['password'], tackle2Token)
self.TokenRenewAfter = int(time.time()) + 4*60 # 4 minutes to refresh token
self.TokenRenewAfter = int(time.time()) + TOKEN_REFRESH_SECONDS

self.encKeyVerified = False
if encKey != "":
Expand Down Expand Up @@ -191,7 +192,7 @@ class TackleTool:
def checkTokenLifetime(self):
if self.TokenRenewAfter < int(time.time()):
self.Token = getHubToken(self.Url, c['username'], c['password'], False)
self.TokenRenewAfter = int(time.time()) + 4*60 # 4 minutes to refresh token
self.TokenRenewAfter = int(time.time()) + TOKEN_REFRESH_SECONDS

def apiJSON(self, url, data=None, method='GET', ignoreErrors=False):
debugPrint("Querying: %s" % url)
Expand Down

0 comments on commit cb1fa02

Please sign in to comment.