File tree Expand file tree Collapse file tree
Sources/SwiftJSONRPC/RequestExecutor/HTTP/Client Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments