From 5c62d18325ef7666543e9967a8707ab2f8990cfe Mon Sep 17 00:00:00 2001 From: "Bryant, Charles" Date: Wed, 21 Aug 2024 11:41:21 -0700 Subject: [PATCH] Change networking timeout default to 60s (Prod to remain 20s) --- lib/app_networking.dart | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/app_networking.dart b/lib/app_networking.dart index 1018310a3..df65a476b 100644 --- a/lib/app_networking.dart +++ b/lib/app_networking.dart @@ -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 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); @@ -35,8 +36,8 @@ class NetworkHelper { Future authorizedFetch( String url, Map 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( @@ -111,8 +112,8 @@ class NetworkHelper { Future authorizedPost( String url, Map? 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) { @@ -142,8 +143,8 @@ class NetworkHelper { Future authorizedPut( String url, Map 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); @@ -171,8 +172,8 @@ class NetworkHelper { Future authorizedDelete( String url, Map 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);