mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 18:53:21 +01:00
[downloader:http] release connection before logging messages
This allows connections to be properly released when using 'actions' feature.
This commit is contained in:
parent
775d2ac999
commit
6f4a843fba
@ -175,8 +175,8 @@ class HttpDownloader(DownloaderBase):
|
|||||||
msg = "'{} {}' for '{}'".format(code, response.reason, url)
|
msg = "'{} {}' for '{}'".format(code, response.reason, url)
|
||||||
if code in retry_codes or 500 <= code < 600:
|
if code in retry_codes or 500 <= code < 600:
|
||||||
continue
|
continue
|
||||||
self.log.warning(msg)
|
|
||||||
self.release_conn(response)
|
self.release_conn(response)
|
||||||
|
self.log.warning(msg)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# check for invalid responses
|
# check for invalid responses
|
||||||
@ -192,24 +192,24 @@ class HttpDownloader(DownloaderBase):
|
|||||||
tries -= 1
|
tries -= 1
|
||||||
continue
|
continue
|
||||||
if not result:
|
if not result:
|
||||||
self.log.warning("Invalid response")
|
|
||||||
self.release_conn(response)
|
self.release_conn(response)
|
||||||
|
self.log.warning("Invalid response")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# check file size
|
# check file size
|
||||||
size = text.parse_int(size, None)
|
size = text.parse_int(size, None)
|
||||||
if size is not None:
|
if size is not None:
|
||||||
if self.minsize and size < self.minsize:
|
if self.minsize and size < self.minsize:
|
||||||
|
self.release_conn(response)
|
||||||
self.log.warning(
|
self.log.warning(
|
||||||
"File size smaller than allowed minimum (%s < %s)",
|
"File size smaller than allowed minimum (%s < %s)",
|
||||||
size, self.minsize)
|
size, self.minsize)
|
||||||
self.release_conn(response)
|
|
||||||
return False
|
return False
|
||||||
if self.maxsize and size > self.maxsize:
|
if self.maxsize and size > self.maxsize:
|
||||||
|
self.release_conn(response)
|
||||||
self.log.warning(
|
self.log.warning(
|
||||||
"File size larger than allowed maximum (%s > %s)",
|
"File size larger than allowed maximum (%s > %s)",
|
||||||
size, self.maxsize)
|
size, self.maxsize)
|
||||||
self.release_conn(response)
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
build_path = False
|
build_path = False
|
||||||
|
Loading…
Reference in New Issue
Block a user