Skip to content

Commit b8302ae

Browse files
committed
Add backoff strategy to auth
1 parent 56f49cb commit b8302ae

File tree

1 file changed

+9
-1
lines changed
  • src/construct_additional_obelisks/asynchronous

1 file changed

+9
-1
lines changed

src/construct_additional_obelisks/asynchronous/client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,15 @@ async def _get_token(self):
100100
async def _verify_token(self):
101101
if (self.token is None
102102
or self.token_expires < (datetime.now() - self.grace_period)):
103-
await self._get_token()
103+
retry = self.retry_strategy.make()
104+
first = True
105+
while first or await retry.should_retry():
106+
first = False
107+
try:
108+
await self._get_token()
109+
return
110+
except:
111+
continue
104112

105113
async def http_post(self, url: str, data: Any = None,
106114
params: dict | None = None) -> httpx.Response:

0 commit comments

Comments
 (0)