Skip to content

Commit

Permalink
resolve comments and fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagaprasadvr committed Jan 17, 2025
1 parent b50867e commit 70ef4bf
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 38 deletions.
2 changes: 1 addition & 1 deletion digital_asset_types/src/dapi/change_logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ fn build_asset_proof(
let mut final_node_list = vec![SimpleChangeLog::default(); req_indexes.len()];
for node in required_nodes.iter() {
if node.level < final_node_list.len().try_into().unwrap() {
final_node_list[node.level as usize] = node.to_owned();
node.clone_into(&mut final_node_list[node.level as usize])
}
}
for (i, (n, nin)) in final_node_list
Expand Down
23 changes: 5 additions & 18 deletions grpc-ingest/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,6 @@ impl ConfigIngestStream {
}
}

#[derive(Debug, Clone, Deserialize, Default)]
#[serde(default)]
pub struct ConfigTopograph {
#[serde(default = "ConfigTopograph::default_num_threads")]
pub num_threads: usize,
}

impl ConfigTopograph {
pub const fn default_num_threads() -> usize {
5
}
}

#[derive(Debug, Clone, Default, Deserialize)]
#[serde(default)]
pub struct ConfigPrometheus {
Expand Down Expand Up @@ -297,12 +284,12 @@ pub struct ConfigIngesterDownloadMetadata {
default = "ConfigIngesterDownloadMetadata::default_num_threads",
deserialize_with = "deserialize_usize_str"
)]
pub num_threads: usize,
pub _num_threads: usize,
#[serde(
default = "ConfigIngesterDownloadMetadata::default_max_attempts",
deserialize_with = "deserialize_usize_str"
)]
pub max_attempts: usize,
pub _max_attempts: usize,
#[serde(
default = "ConfigIngesterDownloadMetadata::default_request_timeout",
deserialize_with = "deserialize_duration_str",
Expand All @@ -318,13 +305,13 @@ pub struct ConfigIngesterDownloadMetadata {
default = "ConfigIngesterDownloadMetadata::default_stream_max_size",
deserialize_with = "deserialize_usize_str"
)]
pub pipeline_max_size: usize,
pub _pipeline_max_size: usize,
#[serde(
default = "ConfigIngesterDownloadMetadata::default_pipeline_max_idle",
deserialize_with = "deserialize_duration_str",
rename = "pipeline_max_idle_ms"
)]
pub pipeline_max_idle: Duration,
pub _pipeline_max_idle: Duration,
}

impl ConfigIngesterDownloadMetadata {
Expand Down Expand Up @@ -366,7 +353,7 @@ pub struct ConfigBubblegumVerify {
default = "ConfigBubblegumVerify::default_report_interval",
deserialize_with = "deserialize_duration_str"
)]
pub report_interval: Duration,
pub _report_interval: Duration,
#[serde(default)]
pub only_trees: Option<Vec<String>>,
#[serde(
Expand Down
2 changes: 1 addition & 1 deletion grpc-ingest/src/prom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ pub fn grpc_tasks_total_dec(label: &str, stream: &str) {
GRPC_TASKS.with_label_values(&[label, stream]).dec()
}

pub fn download_metadata_json_task_inc(status: u16) {
pub fn download_metadata_json_task_status_count_inc(status: u16) {
DOWNLOAD_METADATA_FETCHED_COUNT
.with_label_values(&[&status.to_string()])
.inc();
Expand Down
33 changes: 16 additions & 17 deletions grpc-ingest/src/redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use {
crate::{
config::{ConfigIngestStream, REDIS_STREAM_DATA_KEY},
prom::{
ack_tasks_total_dec, ack_tasks_total_inc, download_metadata_json_task_inc,
ack_tasks_total_dec, ack_tasks_total_inc, download_metadata_json_task_status_count_inc,
ingest_job_time_set, ingest_tasks_total_dec, ingest_tasks_total_inc,
program_transformer_task_status_inc, redis_xack_inc, redis_xlen_set, redis_xread_inc,
ProgramTransformerTaskStatusKind,
Expand Down Expand Up @@ -203,22 +203,21 @@ impl MessageHandler for DownloadMetadataJsonHandle {

Box::pin(async move {
let info = DownloadMetadataInfo::try_parse_msg(input)?;
download_metadata
.handle_download(&info)
.await
.map(|_| {
download_metadata_json_task_inc(200);
})
.map_err(|e| {
if let MetadataJsonTaskError::Fetch(FetchMetadataJsonError::Response {
status: StatusCode::Code(code),
..
}) = &e
{
download_metadata_json_task_inc(code.as_u16());
}
IngestMessageError::DownloadMetadataJson(e)
})
let response = download_metadata.handle_download(&info).await;
let status =
if let Err(MetadataJsonTaskError::Fetch(FetchMetadataJsonError::Response {
status: StatusCode::Code(code),
..
})) = response
{
code.as_u16()
} else {
200
};

download_metadata_json_task_status_count_inc(status);

response.map_err(IngestMessageError::DownloadMetadataJson)
})
}
}
Expand Down
1 change: 1 addition & 0 deletions nft_ingester/src/backfiller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const BLOCK_CACHE_SIZE: usize = 300_000;
const MAX_CACHE_COST: i64 = 32;
const BLOCK_CACHE_DURATION: u64 = 172800;

#[allow(dead_code)]
struct SlotSeq(u64, u64);
/// Main public entry point for backfiller task.
pub fn setup_backfiller<T: Messenger>(
Expand Down
2 changes: 1 addition & 1 deletion program_transformers/src/bubblegum/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ where
pub async fn upsert_asset_creators<T>(
txn: &T,
id: Vec<u8>,
creators: &Vec<Creator>,
creators: &[Creator],
slot_updated: i64,
seq: i64,
) -> ProgramTransformerResult<()>
Expand Down

0 comments on commit 70ef4bf

Please sign in to comment.