Skip to content

Commit

Permalink
dedupe
Browse files Browse the repository at this point in the history
  • Loading branch information
just-in-chang committed Aug 29, 2023
1 parent e23c5b2 commit 397287e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use crate::{
get_uri_metadata,
utils::{
constants::{MAX_JSON_REQUEST_RETRY_SECONDS, MAX_RETRY_TIME_SECONDS},
counters::{FAILED_TO_PARSE_JSON_COUNT, PARSE_JSON_INVOCATION_COUNT},
counters::{
FAILED_TO_PARSE_JSON_COUNT, PARSE_JSON_INVOCATION_COUNT, SUCCESSFULLY_PARSED_JSON_COUNT,
},
},
};
use anyhow::Context;
Expand Down Expand Up @@ -80,7 +82,10 @@ impl JSONParser {
};

match retry(backoff, op).await {
Ok(result) => Ok(result),
Ok(result) => {
SUCCESSFULLY_PARSED_JSON_COUNT.inc();
Ok(result)
},
Err(e) => {
FAILED_TO_PARSE_JSON_COUNT
.with_label_values(&["other"])
Expand Down
5 changes: 1 addition & 4 deletions ecosystem/nft-metadata-crawler-parser/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ use crate::{
DUPLICATE_TOKEN_URI_COUNT, GOT_CONNECTION_COUNT, OPTIMIZE_IMAGE_TYPE_COUNT,
PARSER_FAIL_COUNT, PARSER_INVOCATIONS_COUNT, PARSER_SUCCESSES_COUNT,
PARSE_URI_TYPE_COUNT, PUBSUB_ACK_SUCCESS_COUNT, PUBSUB_STREAM_RESET_COUNT,
SKIP_URI_COUNT, SUCCESSFULLY_OPTIMIZED_IMAGE_COUNT, SUCCESSFULLY_PARSED_JSON_COUNT,
UNABLE_TO_GET_CONNECTION_COUNT,
SKIP_URI_COUNT, UNABLE_TO_GET_CONNECTION_COUNT,
},
database::{
check_or_update_chain_id, establish_connection_pool, run_migrations, upsert_uris,
Expand Down Expand Up @@ -404,7 +403,6 @@ impl Worker {
pubsub_message = self.pubsub_message,
"[NFT Metadata Crawler] Writing JSON to GCS"
);
SUCCESSFULLY_PARSED_JSON_COUNT.inc();
let cdn_json_uri_result =
write_json_to_gcs(self.config.bucket.clone(), self.token_data_id.clone(), json)
.await;
Expand Down Expand Up @@ -513,7 +511,6 @@ impl Worker {
pubsub_message = self.pubsub_message,
"[NFT Metadata Crawler] Saving image to GCS"
);
SUCCESSFULLY_OPTIMIZED_IMAGE_COUNT.inc();
let cdn_image_uri_result = write_image_to_gcs(
format,
self.config.bucket.clone(),
Expand Down

0 comments on commit 397287e

Please sign in to comment.