diff options
| author | Jokler <jokler.contact@gmail.com> | 2018-05-11 23:16:10 +0200 |
|---|---|---|
| committer | Jokler <jokler.contact@gmail.com> | 2018-05-11 23:16:10 +0200 |
| commit | 518fa4a3d523b481e2d72e78361dd979e6c850f4 (patch) | |
| tree | 54cb45f2047038c80094b0522329d5f4cf75d514 /src/plugins | |
| parent | 01d0fe59935c8465a92a2508049f58292545a99f (diff) | |
| download | frippy-518fa4a3d523b481e2d72e78361dd979e6c850f4.tar.gz frippy-518fa4a3d523b481e2d72e78361dd979e6c850f4.zip | |
Url: Use shorter timeout for title downloads
A new function has been added to the Url/download util to allow
setting different timeouts.
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/url.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/url.rs b/src/plugins/url.rs index 1ea6c9c..d769a0b 100644 --- a/src/plugins/url.rs +++ b/src/plugins/url.rs @@ -1,5 +1,7 @@ extern crate htmlescape; +use std::time::Duration; + use irc::client::prelude::*; use regex::Regex; @@ -118,7 +120,8 @@ impl UrlTitles { fn url(&self, text: &str) -> Result<String, UrlError> { let url = self.grep_url(text) .ok_or(ErrorKind::MissingUrl)? - .max_kib(self.max_kib); + .max_kib(self.max_kib) + .timeout(Duration::from_secs(5)); let body = url.request().context(ErrorKind::Download)?; let title = Title::find_clean_title(&body, url.as_str()); |
