update orbit_back_end_helper

This commit is contained in:
chiu 2020-03-16 16:39:51 +08:00
parent 96a40a6326
commit a3a04eee6c
1 changed files with 8 additions and 1 deletions

View File

@ -201,7 +201,14 @@ module OrbitBackendHelper
http.read_timeout = 25 #seconds http.read_timeout = 25 #seconds
request = Net::HTTP::Get.new("/site/permissions") request = Net::HTTP::Get.new("/site/permissions")
request.body = params_to_send.to_query 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? if response.nil?
data = {} data = {}
data["message"] = "Could not connect to the store." data["message"] = "Could not connect to the store."