File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -190,6 +190,17 @@ class AtlanClient(BaseSettings):
190190 class Config :
191191 env_prefix = "atlan_"
192192
193+ @classmethod
194+ def init_for_thread (cls , client : AtlanClient ):
195+ """
196+ Prepares the given client for use in the current thread.
197+
198+ Sets the thread-local context and
199+ resets internal retry flags for multi-threaded environments.
200+ """
201+ AtlanClient .set_current_client (client )
202+ client ._401_tls .has_retried = False
203+
193204 @classmethod
194205 def set_current_client (cls , client : AtlanClient ):
195206 """
@@ -222,8 +233,7 @@ def __init__(self, **data):
222233 adapter = HTTPAdapter (max_retries = self .retry )
223234 session .mount (HTTPS_PREFIX , adapter )
224235 session .mount (HTTP_PREFIX , adapter )
225- AtlanClient .set_current_client (self )
226- self ._401_tls .has_retried = False
236+ AtlanClient .init_for_thread (self )
227237
228238 @property
229239 def admin (self ) -> AdminClient :
You can’t perform that action at this time.
0 commit comments