Skip to content

Commit 99f2fb0

Browse files
authored
Merge pull request salesforce-marketingcloud#58 from clupprich/remove-retry
Remove evil retry
2 parents c68c15d + 3a05772 commit 99f2fb0

File tree

2 files changed

+9
-27
lines changed

2 files changed

+9
-27
lines changed

lib/marketingcloudsdk/rest.rb

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,13 @@ def rest_post url, properties={}
100100
end
101101

102102
private
103-
def rest_request action, url, options={}
104-
retried = false
105-
begin
106-
#Try to refresh the token and if we do then we need to regenerate the header as well.
107-
self.refresh
108-
(options['params'] ||= {}).merge! 'access_token' => access_token
109-
rsp = rest_client.send(action, url, options)
110-
raise 'Unauthorized' if rsp.message == 'Unauthorized'
111-
rescue
112-
raise if retried
113-
self.refresh! # ask for forgiveness not, permission
114-
retried = true
115-
retry
116-
end
117-
rsp
118-
rescue
103+
def rest_request action, url, options={}
104+
#Try to refresh the token and if we do then we need to regenerate the header as well.
105+
self.refresh
106+
(options['params'] ||= {}).merge! 'access_token' => access_token
107+
rsp = rest_client.send(action, url, options)
108+
raise 'Unauthorized' if rsp.message == 'Unauthorized'
109+
119110
rsp
120111
end
121112
end

lib/marketingcloudsdk/soap.rb

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -271,17 +271,8 @@ def soap_cud action, object_type, properties, upsert=nil
271271

272272
def soap_request action, message
273273
response = action.eql?(:describe) ? DescribeResponse : SoapResponse
274-
retried = false
275-
begin
276-
rsp = soap_client.call(action, :message => message)
277-
rescue
278-
raise if retried
279-
retried = true
280-
retry
281-
end
282-
response.new rsp, self
283-
rescue
284-
raise if rsp.nil?
274+
275+
rsp = soap_client.call(action, :message => message)
285276
response.new rsp, self
286277
end
287278
end

0 commit comments

Comments
 (0)