You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the RetryOptions class to handle retry logic in my code, but it seems the retry mechanism is not functioning as expected. Below is the code snippet I am using:
dart
final multiRequest = http.MultipartRequest('POST', _requestUri(path));
multiRequest.files.addAll(files);
if (fields != null) {
multiRequest.fields.addAll(fields.toJson());
}
multiRequest.headers.addAll(
_generateHttpHeader(transmissionType: transmissionType)..addAll({'Content-Type': 'multipart/form-data'}));
const r = RetryOptions(maxAttempts: 5);
final streamResponse = await r.retry(
() async => await multiRequest.send(),
retryIf: (e) => e is SocketException || e is TimeoutException,
onRetry: (e) => logger.warning("onRetry: $e"),
);
When an exception occurs, the onRetry callback is executed only once, and the retryIf callback is also executed only once. Despite having set maxAttempts to 5, the retry mechanism does not retry the operation as expected. Instead, it fails after the first attempt.
Error Log:
csharp
flutter: [WARNING] 11:51:57.945 webapi_repository_impl.dart 120:30 in WebapiRepository.apiUpload.<fn>] onRetry: ClientException with SocketException: Operation timed out (OS Error: Operation timed out, errno = 60), address = aaa.xxx.jp, port = 60599, uri=https://aaa.xxx.jp/api/xxxxx/pdf?sendMail=true
Steps to Reproduce:
Execute the above code snippet with a setup that triggers a SocketException or TimeoutException.
Observe that retries are not performed as expected.
Expected Behavior:
The retry mechanism should retry the operation up to the specified number of attempts (maxAttempts) when a SocketException or TimeoutException occurs.
Additional Information:
Flutter version: 3.19.5
Dependencies:
http: 1.1.0
retry: 3.1.2
Please let me know if you need any additional information or if there is a fix available for this issue.
Thank you!
The text was updated successfully, but these errors were encountered:
Description:
I am using the RetryOptions class to handle retry logic in my code, but it seems the retry mechanism is not functioning as expected. Below is the code snippet I am using:
dart
When an exception occurs, the onRetry callback is executed only once, and the retryIf callback is also executed only once. Despite having set maxAttempts to 5, the retry mechanism does not retry the operation as expected. Instead, it fails after the first attempt.
Error Log:
csharp
Steps to Reproduce:
Execute the above code snippet with a setup that triggers a SocketException or TimeoutException.
Observe that retries are not performed as expected.
Expected Behavior:
The retry mechanism should retry the operation up to the specified number of attempts (maxAttempts) when a SocketException or TimeoutException occurs.
Additional Information:
Flutter version: 3.19.5
Dependencies:
http: 1.1.0
retry: 3.1.2
Please let me know if you need any additional information or if there is a fix available for this issue.
Thank you!
The text was updated successfully, but these errors were encountered: