Skip to content

Commit

Permalink
nft ingester: add backfill workers count to config (#129)
Browse files Browse the repository at this point in the history
fanatid authored Oct 12, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 89aa1f0 commit bd81f66
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 12 additions & 0 deletions nft_ingester/src/config.rs
Original file line number Diff line number Diff line change
@@ -28,7 +28,9 @@ pub struct IngesterConfig {
pub role: Option<IngesterRole>,
pub max_postgres_connections: Option<u32>,
pub account_stream_worker_count: Option<u32>,
pub account_backfill_stream_worker_count: Option<u32>,
pub transaction_stream_worker_count: Option<u32>,
pub transaction_backfill_stream_worker_count: Option<u32>,
pub code_version: Option<&'static str>,
pub background_task_runner_config: Option<BackgroundTaskRunnerConfig>,
pub cl_audits: Option<bool>, // save transaction logs for compressed nfts
@@ -68,9 +70,19 @@ impl IngesterConfig {
self.account_stream_worker_count.unwrap_or(2)
}

pub fn get_account_backfill_stream_worker_count(&self) -> u32 {
self.account_backfill_stream_worker_count
.unwrap_or_else(|| self.get_account_stream_worker_count())
}

pub fn get_transaction_stream_worker_count(&self) -> u32 {
self.transaction_stream_worker_count.unwrap_or(2)
}

pub fn get_transaction_backfill_stream_worker_count(&self) -> u32 {
self.transaction_backfill_stream_worker_count
.unwrap_or_else(|| self.get_transaction_stream_worker_count())
}
}

// Types and constants used for Figment configuration items.
6 changes: 4 additions & 2 deletions nft_ingester/src/main.rs
Original file line number Diff line number Diff line change
@@ -149,7 +149,8 @@ pub async fn main() -> Result<(), IngesterError> {
},
ACCOUNT_STREAM,
);

}
for i in 0..config.get_account_backfill_stream_worker_count() {
let _account_backfill = account_worker::<RedisMessenger>(
database_pool.clone(),
config.get_messneger_client_config(),
@@ -177,7 +178,8 @@ pub async fn main() -> Result<(), IngesterError> {
config.cl_audits.unwrap_or(false),
TRANSACTION_STREAM,
);

}
for i in 0..config.get_transaction_backfill_stream_worker_count() {
let _txn_backfill = transaction_worker::<RedisMessenger>(
database_pool.clone(),
config.get_messneger_client_config(),

0 comments on commit bd81f66

Please sign in to comment.