Skip to content

Commit

Permalink
Merge pull request #2064 from c3bryant/networking-timeout-increase-qa
Browse files Browse the repository at this point in the history
Increase Networking Timeout Default
  • Loading branch information
c3bryant authored Aug 21, 2024
2 parents 6845485 + 74f5c9f commit ed832f5
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions lib/app_networking.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ class NetworkHelper {
static const int SSO_REFRESH_MAX_RETRIES = 3;
static const int SSO_REFRESH_RETRY_INCREMENT = 5000;
static const int SSO_REFRESH_RETRY_MULTIPLIER = 3;
static const int DEFAULT_TIMEOUT = 60000;

Future<dynamic> fetchData(String url) async {
Dio dio = new Dio();
dio.options.connectTimeout = 20000;
dio.options.receiveTimeout = 20000;
dio.options.connectTimeout = DEFAULT_TIMEOUT;
dio.options.receiveTimeout = DEFAULT_TIMEOUT;
dio.options.responseType = ResponseType.plain;
final _response = await dio.get(url);

Expand All @@ -35,8 +36,8 @@ class NetworkHelper {
Future<dynamic> authorizedFetch(
String url, Map<String, String> headers) async {
Dio dio = new Dio();
dio.options.connectTimeout = 20000;
dio.options.receiveTimeout = 20000;
dio.options.connectTimeout = DEFAULT_TIMEOUT;
dio.options.receiveTimeout = DEFAULT_TIMEOUT;
dio.options.responseType = ResponseType.plain;
dio.options.headers = headers;
final _response = await dio.get(
Expand Down Expand Up @@ -111,8 +112,8 @@ class NetworkHelper {
Future<dynamic> authorizedPost(
String url, Map<String, String>? headers, dynamic body) async {
Dio dio = new Dio();
dio.options.connectTimeout = 20000;
dio.options.receiveTimeout = 20000;
dio.options.connectTimeout = DEFAULT_TIMEOUT;
dio.options.receiveTimeout = DEFAULT_TIMEOUT;
dio.options.headers = headers;
final _response = await dio.post(url, data: body);
if (_response.statusCode == 200 || _response.statusCode == 201) {
Expand Down Expand Up @@ -142,8 +143,8 @@ class NetworkHelper {
Future<dynamic> authorizedPut(
String url, Map<String, String> headers, dynamic body) async {
Dio dio = new Dio();
dio.options.connectTimeout = 20000;
dio.options.receiveTimeout = 20000;
dio.options.connectTimeout = DEFAULT_TIMEOUT;
dio.options.receiveTimeout = DEFAULT_TIMEOUT;
dio.options.headers = headers;
final _response = await dio.put(url, data: body);

Expand Down Expand Up @@ -171,8 +172,8 @@ class NetworkHelper {
Future<dynamic> authorizedDelete(
String url, Map<String, String> headers) async {
Dio dio = new Dio();
dio.options.connectTimeout = 20000;
dio.options.receiveTimeout = 20000;
dio.options.connectTimeout = DEFAULT_TIMEOUT;
dio.options.receiveTimeout = DEFAULT_TIMEOUT;
dio.options.headers = headers;
try {
final _response = await dio.delete(url);
Expand Down

0 comments on commit ed832f5

Please sign in to comment.