File tree Expand file tree Collapse file tree
src/PowerPlatform/Dataverse Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ def __init__(self, credential: AsyncTokenCredential) -> None:
4141 self ._lock = asyncio .Lock ()
4242 self ._refresh_jitter : int = 0
4343
44- def _need_new_token (self ) -> bool :
44+ def _should_refresh (self ) -> bool :
4545 """Return ``True`` when the cached token is missing or near expiry."""
4646 if self ._token is None :
4747 return True
@@ -66,11 +66,11 @@ async def _acquire_token(self, scope: str) -> _TokenPair:
6666 :rtype: ~PowerPlatform.Dataverse.core._auth._TokenPair
6767 :raises ~azure.core.exceptions.ClientAuthenticationError: If token acquisition fails.
6868 """
69- if not self ._need_new_token ():
69+ if not self ._should_refresh ():
7070 return _TokenPair (resource = scope , access_token = self ._token .token )
7171 async with self ._lock :
7272 # Double-check after acquiring lock — another coroutine may have refreshed.
73- if not self ._need_new_token ():
73+ if not self ._should_refresh ():
7474 return _TokenPair (resource = scope , access_token = self ._token .token )
7575 try :
7676 self ._token = await self .credential .get_token (scope )
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ def __init__(self, credential: TokenCredential) -> None:
6868 self ._lock = threading .Lock ()
6969 self ._refresh_jitter : int = 0
7070
71- def _need_new_token (self ) -> bool :
71+ def _should_refresh (self ) -> bool :
7272 """Return ``True`` when the cached token is missing or near expiry."""
7373 if self ._token is None :
7474 return True
@@ -92,11 +92,11 @@ def _acquire_token(self, scope: str) -> _TokenPair:
9292 :rtype: ~PowerPlatform.Dataverse.core._auth._TokenPair
9393 :raises ~azure.core.exceptions.ClientAuthenticationError: If token acquisition fails.
9494 """
95- if not self ._need_new_token ():
95+ if not self ._should_refresh ():
9696 return _TokenPair (resource = scope , access_token = self ._token .token )
9797 with self ._lock :
9898 # Double-check after acquiring lock — another thread may have refreshed.
99- if not self ._need_new_token ():
99+ if not self ._should_refresh ():
100100 return _TokenPair (resource = scope , access_token = self ._token .token )
101101 try :
102102 self ._token = self .credential .get_token (scope )
You can’t perform that action at this time.
0 commit comments