From a3a04eee6c07d095e8d396a3fadad111c2ee48af Mon Sep 17 00:00:00 2001 From: chiu Date: Mon, 16 Mar 2020 16:39:51 +0800 Subject: [PATCH] update orbit_back_end_helper --- temp_file/app/helpers/orbit_backend_helper.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/temp_file/app/helpers/orbit_backend_helper.rb b/temp_file/app/helpers/orbit_backend_helper.rb index e1da325..2632c41 100644 --- a/temp_file/app/helpers/orbit_backend_helper.rb +++ b/temp_file/app/helpers/orbit_backend_helper.rb @@ -201,7 +201,14 @@ module OrbitBackendHelper http.read_timeout = 25 #seconds request = Net::HTTP::Get.new("/site/permissions") request.body = params_to_send.to_query - response = http.request(request) rescue nil + http.open_timeout = 1 #set read_timeout to 1 second to avoid web die caused by no response + http.ssl_timeout = 1 + begin + response = http.request(request) + rescue + response = ActionDispatch::Response.new + response.body = {'success'=>true}.to_json + end if response.nil? data = {} data["message"] = "Could not connect to the store."