Skip to content

Commit

Permalink
Merge pull request #13 from AIBlockOfficial/bugfix_get_data_id
Browse files Browse the repository at this point in the history
Fix for get_data with ID
  • Loading branch information
BHouwens authored Aug 20, 2024
2 parents 93204d2 + 2aec6f2 commit 334715c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "valence"
version = "0.1.2"
version = "0.1.3"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
8 changes: 4 additions & 4 deletions src/api/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ pub async fn get_data_handler<

// Check cache first
let mut cache_lock_result = cache.lock().await;
let cache_result: Result<Option<HashMap<String, String>>, _> = cache_lock_result
.get_data::<String>(address, value_id.as_deref())
.await;
let cache_result: Result<Option<HashMap<String, String>>, _> =
cache_lock_result.get_data::<String>(address, None).await;

match cache_result {
Ok(value) => {
match value {
Some(value) => {
info!("Data retrieved from cache");
info!("Data retrieved from cache: {:?}", value);

if let Some(id) = value_id {
if !value.contains_key(&id) {
return r.into_err_internal(ApiErrorType::ValueIdNotFound);
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ async fn main() {

info!("Cuckoo filter initialized successfully");

let routes = get_data(db_conn.clone(), cache_conn.clone(), cuckoo_filter.clone())
.or(get_data_with_id(
let routes = get_data_with_id(db_conn.clone(), cache_conn.clone(), cuckoo_filter.clone())
.or(get_data(
db_conn.clone(),
cache_conn.clone(),
cuckoo_filter.clone(),
Expand Down
2 changes: 1 addition & 1 deletion src/tests/interfaces.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashMap, hash::Hash};
use std::collections::HashMap;

use crate::db::handler::{CacheHandler, KvStoreConnection};
use async_trait::async_trait;
Expand Down

0 comments on commit 334715c

Please sign in to comment.