Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify scanner interval. #273

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion explorer/src/service/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use axum::http::StatusCode;
use axum::response::{IntoResponse, Response};
use sqlx::Error::RowNotFound;
use std::num::ParseFloatError;

#[derive(Debug)]
Expand Down Expand Up @@ -73,7 +74,12 @@ impl IntoResponse for ExplorerError {
fn into_response(self) -> Response {
let err_msg = match self {
ExplorerError::Custom(e) => e,
ExplorerError::DBErr(e) => e.to_string(),
ExplorerError::DBErr(e) => {
if let RowNotFound = e {
return (StatusCode::NOT_FOUND, "not found").into_response();
}
e.to_string()
}
ExplorerError::IOErr(e) => e.to_string(),
ExplorerError::TomlDeErr(e) => e.to_string(),
ExplorerError::HexErr(e) => e.to_string(),
Expand Down
3 changes: 1 addition & 2 deletions prismer/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use crate::{Error, Result};
const DEFAULT_TIMEOUT_SECS: u64 = 32;
const DEFAULT_RETIES: usize = 3;
const DEFAULT_CONCURRENCY: usize = 8;
//const DEFAULT_INTERVAL: Duration = Duration::from_secs(15);

/// load block at specific height.
#[derive(Parser, Debug)]
Expand Down Expand Up @@ -141,7 +140,7 @@ impl Subscribe {

let itv = env::var("INTERVAL")
.ok()
.unwrap_or(String::from("15"))
.unwrap_or("10".to_string())
.parse::<u64>()?;
let interval = Duration::from_secs(itv);
info!("interval={:?}", interval);
Expand Down
Loading