Skip to content

Commit 8eb995a

Browse files
committed
HACK: timeout
1 parent 993a708 commit 8eb995a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

Sources/SwiftJSONRPC/RequestExecutor/HTTP/Client/URLSessionHTTPClient.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct URLSessionHTTPClient: HTTPClient {
1515

1616
// MARK: - Initialization
1717

18-
init(urlSession: URLSession = .shared) {
18+
init(urlSession: URLSession = newURLSession()) {
1919
self.urlSession = urlSession
2020
}
2121

@@ -57,6 +57,13 @@ struct URLSessionHTTPClient: HTTPClient {
5757
return DispatchQueue.global()
5858
}
5959

60+
private static func newURLSession() -> URLSession {
61+
let config = URLSessionConfiguration.default
62+
config.timeoutIntervalForRequest = 10 * 60
63+
config.timeoutIntervalForResource = 10 * 60
64+
return URLSession(configuration: config)
65+
}
66+
6067
// MARK: - Inner Types
6168

6269
class URLSessionError: NestedError<Error>, HTTPClientError { }
@@ -75,6 +82,7 @@ extension HTTPRequest {
7582
request.httpMethod = method.rawValue
7683
request.allHTTPHeaderFields = headers
7784
request.httpBody = body
85+
request.timeoutInterval = 10 * 60
7886

7987
return request
8088
}

0 commit comments

Comments
 (0)