Skip to content

Commit

Permalink
modify scanner interval. (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
blowcowbeer authored Jun 29, 2024
1 parent d2af1f9 commit c8ab7ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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

0 comments on commit c8ab7ff

Please sign in to comment.