[plugin] Wallabag: different timeouts for API calls vs file downloads (#7668)

Fixes <https://github.com/koreader/koreader/issues/7650>.
reviewable/pr7673/r1
Frans de Jonge 3 years ago committed by GitHub
parent f0ecbeb1d5
commit 341d6ac660
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -565,8 +565,10 @@ function Wallabag:callAPI(method, apiurl, headers, body, filepath, quiet)
request.method = method
if filepath ~= "" then
request.sink = ltn12.sink.file(io.open(filepath, "w"))
socketutil:set_timeout(socketutil.FILE_BLOCK_TIMEOUT, socketutil.FILE_TOTAL_TIMEOUT)
else
request.sink = ltn12.sink.table(sink)
socketutil:set_timeout(socketutil.LARGE_BLOCK_TIMEOUT, socketutil.LARGE_TOTAL_TIMEOUT)
end
request.headers = headers
if body ~= "" then
@ -575,7 +577,6 @@ function Wallabag:callAPI(method, apiurl, headers, body, filepath, quiet)
logger.dbg("Wallabag: URL ", request.url)
logger.dbg("Wallabag: method ", method)
socketutil:set_timeout(socketutil.LARGE_BLOCK_TIMEOUT, socketutil.LARGE_TOTAL_TIMEOUT)
local code, resp_headers = socket.skip(1, http.request(request))
socketutil:reset_timeout()
-- raise error message when network is unavailable

Loading…
Cancel
Save