mirror of
https://github.com/matrix-construct/construct
synced 2024-09-27 19:28:52 +02:00
modules/media/media: Add conf item for download timeout.
This commit is contained in:
parent
1edab7bb15
commit
499e725e73
1 changed files with 8 additions and 2 deletions
|
@ -214,6 +214,13 @@ catch(const ircd::server::unavailable &e)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
conf::item<seconds>
|
||||||
|
media_download_timeout
|
||||||
|
{
|
||||||
|
{ "name", "ircd.media.download.timeout" },
|
||||||
|
{ "default", 15L },
|
||||||
|
};
|
||||||
|
|
||||||
std::pair<http::response::head, unique_buffer<mutable_buffer>>
|
std::pair<http::response::head, unique_buffer<mutable_buffer>>
|
||||||
download(const mutable_buffer &head_buf,
|
download(const mutable_buffer &head_buf,
|
||||||
const string_view &server,
|
const string_view &server,
|
||||||
|
@ -253,8 +260,7 @@ download(const mutable_buffer &head_buf,
|
||||||
remote, { out_head }, { in_head, in_content }, opts
|
remote, { out_head }, { in_head, in_content }, opts
|
||||||
};
|
};
|
||||||
|
|
||||||
//TODO: conf
|
if(!remote_request.wait(seconds(media_download_timeout), std::nothrow))
|
||||||
if(!remote_request.wait(seconds(10), std::nothrow))
|
|
||||||
throw http::error
|
throw http::error
|
||||||
{
|
{
|
||||||
http::REQUEST_TIMEOUT
|
http::REQUEST_TIMEOUT
|
||||||
|
|
Loading…
Reference in a new issue