diff --git a/Sources/App/routes.swift b/Sources/App/routes.swift index 74436d7..480cccb 100644 --- a/Sources/App/routes.swift +++ b/Sources/App/routes.swift @@ -16,9 +16,13 @@ func routes(_ app: Application) throws { app.get("status", ":url") { req -> [String: String] in let url = URL(string: "http://\(req.parameters.get("url")!)") + let config = URLSessionConfiguration.default + config.timeoutIntervalForRequest = 5 + config.timeoutIntervalForResource = 5 var statusDict: [String:String] = [:] var headReq = URLRequest(url: url!) headReq.httpMethod = "HEAD" + headReq.timeoutInterval = 5 let semaphore = DispatchSemaphore(value: 0) URLSession.shared.dataTask(with: headReq, completionHandler: { (_, response, error) in if let httpURLResponse = response as? HTTPURLResponse {