Skip to content

Commit

Permalink
Fixed bug of timeout timer not getting reset
Browse files Browse the repository at this point in the history
Timeout timer was only getting reset on a successful call. So on a failed call, even if the user set it not to retry, it would one time anyway, when timeout timer was called.
  • Loading branch information
ecrichlow committed Dec 18, 2024
1 parent e310a9a commit 4e00e30
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ public class IoGLiveDataRequestResponse : IoGDataRequestResponse, URLSessionDele

public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?)
{
if let timer = timeoutTimer
{
timer.invalidate()
timeoutTimer = nil
}
end = Date()
let callback = self.callbackInfo[IoGConfigurationManager.requestResponseKeyCallback] as! (IoGDataRequestResponse) -> ()
if let err = error
Expand Down Expand Up @@ -253,6 +258,11 @@ public class IoGLiveDataRequestResponse : IoGDataRequestResponse, URLSessionDele
// TODO: May need to comment this one out
public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void)
{
if let timer = timeoutTimer
{
timer.invalidate()
timeoutTimer = nil
}
guard let httpResponse = response as? HTTPURLResponse
else
{
Expand Down

0 comments on commit 4e00e30

Please sign in to comment.