Skip to content

Commit

Permalink
fix lifetime
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid committed Nov 27, 2023
1 parent eb84064 commit 3fd93d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions nft_ingester/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const DEFAULT_MAX: u32 = 125;
pub async fn setup_database(config: IngesterConfig) -> PgPool {
let max = config.max_postgres_connections.unwrap_or(DEFAULT_MAX);
if config.role == Some(IngesterRole::All) || config.role == Some(IngesterRole::Ingester) {
let relative_max =
config.get_account_stream_worker_count() + config.get_transaction_stream_worker_count();
let relative_max: u32 =
config.get_worker_config().iter().map(|c| c.worker_count).sum();
let should_be_at_least = relative_max * 5;
if should_be_at_least > max {
panic!("Please increase max_postgres_connections to at least {}, at least 5 connections per worker process should be given", should_be_at_least);
Expand Down
4 changes: 2 additions & 2 deletions nft_ingester/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ pub async fn main() -> Result<(), IngesterError> {

// iterate all the workers
for worker in workers {
let stream_name = worker.stream_name.to_owned().as_str();
let stream_name = Box::leak(Box::new(worker.stream_name.to_owned()));

let mut timer_worker = StreamSizeTimer::new(
stream_metrics_timer,
config.messenger_config.clone(),
stream_name.clone(),
stream_name.as_str(),
)?;

if let Some(t) = timer_worker.start::<RedisMessenger>().await {
Expand Down

0 comments on commit 3fd93d5

Please sign in to comment.