You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2021/12/04 16:45:23 UTC
[airflow] branch main updated: Databricks hook: fix expiration time check (#20036)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 4925b37 Databricks hook: fix expiration time check (#20036)
4925b37 is described below
commit 4925b37b661a1117dc9f1a10be11f03e67e1a413
Author: Alex Ott <al...@gmail.com>
AuthorDate: Sat Dec 4 17:44:55 2021 +0100
Databricks hook: fix expiration time check (#20036)
There was a logical error in the check of expiration time that could
lead to authentication failures when executing long-running jobs
---
airflow/providers/databricks/hooks/databricks.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/airflow/providers/databricks/hooks/databricks.py b/airflow/providers/databricks/hooks/databricks.py
index a9da65e..9e4ecaf 100644
--- a/airflow/providers/databricks/hooks/databricks.py
+++ b/airflow/providers/databricks/hooks/databricks.py
@@ -176,7 +176,7 @@ class DatabricksHook(BaseHook):
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...")