diff --git a/lib/http/retry_interceptor.dart b/lib/http/retry_interceptor.dart index 53d24464d..157b4e1ae 100644 --- a/lib/http/retry_interceptor.dart +++ b/lib/http/retry_interceptor.dart @@ -1,5 +1,6 @@ import 'package:PiliPlus/http/init.dart'; import 'package:dio/dio.dart'; +import 'package:http2/http2.dart'; class RetryInterceptor extends Interceptor { final int _count; @@ -50,7 +51,10 @@ class RetryInterceptor extends Interceptor { case DioExceptionType.connectionTimeout: case DioExceptionType.sendTimeout: case DioExceptionType.unknown: - if ((err.requestOptions.extra['_rt'] ??= 0) < _count) { + if ((err.requestOptions.extra['_rt'] ??= 0) < _count && + err.error + is! TransportConnectionException // 网络中断, 此时请求可能已经被服务器所接收 + ) { Future.delayed( Duration( milliseconds: ++err.requestOptions.extra['_rt'] * _delay,