Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yuunlimm committed Jun 24, 2024
1 parent ff30202 commit 3cf9386
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
5 changes: 4 additions & 1 deletion rust/indexer-metrics/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ async fn start_processor_status_fetch(url: String, chain_name: String) {
HASURA_API_LATEST_TRANSACTION_TIMESTAMP
.with_label_values(&[&processor.processor, &chain_name])
.set(
processor.last_transaction_timestamp.and_utc().timestamp_micros() as f64
processor
.last_transaction_timestamp
.and_utc()
.timestamp_micros() as f64
* 1e-6,
);
let latency = system_time_now - processor.last_transaction_timestamp;
Expand Down
6 changes: 5 additions & 1 deletion rust/processor/src/bq_analytics/generic_parquet_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ fn create_new_writer(
.set_compression(parquet::basic::Compression::LZ4)
.build();
let props_arc = Arc::new(props);
let file: File = File::options().create(true).write(true).open(file_path)?;
let file: File = File::options()
.create(true)
.truncate(true)
.write(true)
.open(file_path)?;

Ok(SerializedFileWriter::new(
file.try_clone()?,
Expand Down
5 changes: 1 addition & 4 deletions rust/processor/src/processors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,7 @@ impl ProcessorConfig {
}

pub fn is_parquet_processor(&self) -> bool {
match self {
ProcessorConfig::DefaultParquetProcessor(_) => true,
_ => false,
}
matches!(self, ProcessorConfig::DefaultParquetProcessor(_))
}
}

Expand Down
4 changes: 2 additions & 2 deletions rust/processor/src/utils/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,14 +514,14 @@ mod tests {
},
1,
);
assert_eq!(ts.timestamp(), 1649560602);
assert_eq!(ts.and_utc().timestamp(), 1649560602);
assert_eq!(ts.year(), 2022);

let ts2 = parse_timestamp_secs(600000000000000, 2);
assert_eq!(ts2.year(), 9999);

let ts3 = parse_timestamp_secs(1659386386, 2);
assert_eq!(ts3.timestamp(), 1659386386);
assert_eq!(ts3.and_utc().timestamp(), 1659386386);
}

#[test]
Expand Down

0 comments on commit 3cf9386

Please sign in to comment.