Skip to content

Commit

Permalink
Merge pull request #34 from bcnmy/dev
Browse files Browse the repository at this point in the history
fix: cache update
  • Loading branch information
AmanRaj1608 authored Jul 16, 2024
2 parents f7235be + 1e61b53 commit cef9d41
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
7 changes: 4 additions & 3 deletions bin/reflux/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ use std::time::Duration;
use axum::http::Method;
use clap::Parser;
use dotenv::dotenv;
use futures_util::future::join_all;
use log::{debug, error, info};
use tokio::join;
use tokio::sync::Mutex;
use tower_http::cors::{Any, CorsLayer};

Expand Down Expand Up @@ -52,7 +50,7 @@ async fn main() {
}
simple_logger::SimpleLogger::new().env().init().unwrap();

let mut args = Args::parse();
let args = Args::parse();
debug!("Args: {:?}", args);

if args.indexer && args.solver {
Expand Down Expand Up @@ -177,6 +175,9 @@ async fn run_solver(config: Arc<Config>) {
})
.collect();

// run the cache refresh once at the start
routing_engine.refresh_cache().await;

// API service controller
let chain_supported: Vec<(u32, String)> =
config.chains.iter().map(|(id, chain)| (*id, chain.name.clone())).collect();
Expand Down
11 changes: 5 additions & 6 deletions crates/routing-engine/src/routing_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ use thiserror::Error;
use tokio::sync::RwLock;

use account_aggregation::{service::AccountAggregationService, types::TokenWithBalance};
use config::{ChainConfig, Config, config::BucketConfig, SolverConfig, TokenConfig};
use config::{config::BucketConfig, ChainConfig, Config, SolverConfig, TokenConfig};
use storage::{KeyValueStore, RedisClient, RedisClientError};

use crate::{
BridgeResult,
BridgeResultVecWrapper, estimator::{Estimator, LinearRegressionEstimator}, Route,
estimator::{Estimator, LinearRegressionEstimator},
BridgeResult, BridgeResultVecWrapper, Route,
};
use crate::token_price::utils::get_token_price;

/// (from_chain, to_chain, from_token, to_token)
#[derive(Debug)]
Expand Down Expand Up @@ -345,12 +344,12 @@ mod tests {
use config::{BucketConfig, ChainConfig, SolverConfig, TokenConfig, TokenConfigByChainConfigs};
use storage::mongodb_client::MongoDBClient;

use crate::estimator::Estimator;
use crate::routing_engine::PathQuery;
use crate::{
estimator::{DataPoint, LinearRegressionEstimator},
routing_engine::{RoutingEngine, RoutingEngineError},
};
use crate::estimator::Estimator;
use crate::routing_engine::PathQuery;

#[tokio::test]
async fn test_get_cached_data() -> Result<(), RoutingEngineError> {
Expand Down

0 comments on commit cef9d41

Please sign in to comment.