use constant durations (#8278)

* use constant durations

* fix CI

* address comments
This commit is contained in:
Ryan Leung
2018-04-02 16:47:56 +08:00
committed by Tomasz Drwięga
parent 68a08df9c3
commit 9c9ddaccec
12 changed files with 88 additions and 84 deletions

View File

@@ -32,7 +32,7 @@ use handlers::{ContentHandler, StreamingHandler};
use page::local;
use {Embeddable};
const FETCH_TIMEOUT: u64 = 300;
const FETCH_TIMEOUT: Duration = Duration::from_secs(300);
pub enum ValidatorResponse {
Local(local::Dapp),
@@ -57,7 +57,7 @@ impl Default for FetchControl {
FetchControl {
abort: Arc::new(AtomicBool::new(false)),
listeners: Arc::new(Mutex::new(Vec::new())),
deadline: Instant::now() + Duration::from_secs(FETCH_TIMEOUT),
deadline: Instant::now() + FETCH_TIMEOUT,
}
}
}
@@ -193,7 +193,7 @@ impl Errors {
ContentHandler::error(
StatusCode::GatewayTimeout,
"Download Timeout",
&format!("Could not fetch content within {} seconds.", FETCH_TIMEOUT),
&format!("Could not fetch content within {} seconds.", FETCH_TIMEOUT.as_secs()),
None,
self.embeddable_on.clone(),
)