Catch SSL shutdown errors when closing clients

This commit is contained in:
Zed 2020-01-01 17:24:24 +01:00
commit ee43d8cfb1
3 changed files with 11 additions and 3 deletions

View file

@ -26,7 +26,9 @@ proc genHeaders*(agent: string; referer: Uri; lang=true;
template newClient*() {.dirty.} =
var client = newAsyncHttpClient()
defer: client.close()
defer:
try: client.close()
except: discard
client.headers = headers
proc fetchHtml*(url: Uri; headers: HttpHeaders; jsonKey = ""): Future[XmlNode] {.async.} =