From 171ccd19601a90c40375b61d4a40ffd9f2519aa5 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Fri, 14 May 2021 16:40:06 +0300 Subject: [PATCH] Increase timeout for selfupdate --- lib/constants.dart | 1 + lib/data/web_client.dart | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/constants.dart b/lib/constants.dart index 9cff24511..9cf222ea9 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -129,6 +129,7 @@ const int kMaxNumberOfCompanies = 10; const int kMaxNumberOfHistory = 50; const int kMaxRecordsPerApiPage = 5000; const int kMaxPostSeconds = 30; +const int kMaxRawPostSeconds = 180; const int kMillisecondsToRefreshData = 1000 * 60 * 15; // 15 minutes const int kUpdatedAtBufferSeconds = 600; const int kMillisecondsToRefreshActivities = 1000 * 60 * 60 * 24; // 1 day diff --git a/lib/data/web_client.dart b/lib/data/web_client.dart index c71ce7873..09857f4f6 100644 --- a/lib/data/web_client.dart +++ b/lib/data/web_client.dart @@ -79,16 +79,22 @@ class WebClient { response = await _uploadFiles(url, token, multipartFiles, data: data); } else { response = await http.Client() - .post(url, - body: data, - headers: _getHeaders( - url, - token, - secret: secret, - password: password, - idToken: idToken, - )) - .timeout(const Duration(seconds: kMaxPostSeconds)); + .post( + url, + body: data, + headers: _getHeaders( + url, + token, + secret: secret, + password: password, + idToken: idToken, + ), + ) + .timeout( + Duration( + seconds: rawResponse ? kMaxRawPostSeconds : kMaxPostSeconds, + ), + ); } if (rawResponse) {