Skip to content

Commit

Permalink
Databricks hook: fix expiration time check (#20036)
Browse files Browse the repository at this point in the history
There was a logical error in the check of expiration time that could
lead to authentication failures when executing long-running jobs
  • Loading branch information
alexott committed Dec 4, 2021
1 parent d0cea6d commit 4925b37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion airflow/providers/databricks/hooks/databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _get_aad_token(self, resource: str) -> str:
if resource in self.aad_tokens:
d = self.aad_tokens[resource]
now = int(time.time())
if d['expires_on'] > (now - TOKEN_REFRESH_LEAD_TIME): # it expires in more than 5 minutes
if d['expires_on'] > (now + TOKEN_REFRESH_LEAD_TIME): # it expires in more than 2 minutes
return d['token']
self.log.info("Existing AAD token is expired, or going to expire soon. Refreshing...")

Expand Down

0 comments on commit 4925b37

Please sign in to comment.