Skip to content

Commit da7469c

Browse files
committed
Move HTTP client creation inside the API client retry callback block.
1 parent e76fcac commit da7469c

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

app/lib/tool/utils/pub_api_client.dart

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,18 @@ Future<R> withRetryPubApiClient<R>(
116116
/// The enabled experiments that will be part of the experimental cookie.
117117
Set<String>? experiments,
118118
}) async {
119-
final httpClient = httpClientWithAuthorization(
120-
tokenProvider: () async => authToken,
121-
sessionIdProvider: () async => sessionId,
122-
csrfTokenProvider: () async => csrfToken,
123-
cookieProvider: () async => {
124-
if (experiments != null) experimentalCookieName: experiments.join(':'),
125-
},
126-
client: http.Client(),
127-
);
128119
return await retry(
129120
() async {
121+
final httpClient = httpClientWithAuthorization(
122+
tokenProvider: () async => authToken,
123+
sessionIdProvider: () async => sessionId,
124+
csrfTokenProvider: () async => csrfToken,
125+
cookieProvider: () async => {
126+
if (experiments != null)
127+
experimentalCookieName: experiments.join(':'),
128+
},
129+
client: http.Client(),
130+
);
130131
try {
131132
final apiClient = PubApiClient(
132133
pubHostedUrl ?? activeConfiguration.primaryApiUri!.toString(),

0 commit comments

Comments
 (0)