Skip to content

Commit

Permalink
Move HTTP client creation inside the API client retry callback block.
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos committed Feb 11, 2025
1 parent e76fcac commit da7469c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions app/lib/tool/utils/pub_api_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,18 @@ Future<R> withRetryPubApiClient<R>(
/// The enabled experiments that will be part of the experimental cookie.
Set<String>? experiments,
}) async {
final httpClient = httpClientWithAuthorization(
tokenProvider: () async => authToken,
sessionIdProvider: () async => sessionId,
csrfTokenProvider: () async => csrfToken,
cookieProvider: () async => {
if (experiments != null) experimentalCookieName: experiments.join(':'),
},
client: http.Client(),
);
return await retry(
() async {
final httpClient = httpClientWithAuthorization(
tokenProvider: () async => authToken,
sessionIdProvider: () async => sessionId,
csrfTokenProvider: () async => csrfToken,
cookieProvider: () async => {
if (experiments != null)
experimentalCookieName: experiments.join(':'),
},
client: http.Client(),
);
try {
final apiClient = PubApiClient(
pubHostedUrl ?? activeConfiguration.primaryApiUri!.toString(),
Expand Down

0 comments on commit da7469c

Please sign in to comment.