@@ -4,6 +4,7 @@ use hashlink::LinkedHashMap;
44use starknet:: core:: types:: Event ;
55use starknet:: providers:: Provider ;
66use starknet_crypto:: Felt ;
7+ use tokio:: runtime:: Runtime ;
78use tokio:: sync:: Semaphore ;
89use torii_cache:: Cache ;
910use torii_proto:: ContractType ;
@@ -48,6 +49,7 @@ pub struct TaskManager<P: Provider + Send + Sync + Clone + std::fmt::Debug + 'st
4849 processors : Arc < Processors < P > > ,
4950 event_processor_config : EventProcessorConfig ,
5051 nft_metadata_semaphore : Arc < Semaphore > ,
52+ nft_metadata_runtime : Arc < Runtime > ,
5153}
5254
5355impl < P : Provider + Send + Sync + Clone + std:: fmt:: Debug + ' static > TaskManager < P > {
@@ -58,6 +60,7 @@ impl<P: Provider + Send + Sync + Clone + std::fmt::Debug + 'static> TaskManager<
5860 processors : Arc < Processors < P > > ,
5961 max_concurrent_tasks : usize ,
6062 event_processor_config : EventProcessorConfig ,
63+ nft_metadata_runtime : Arc < Runtime > ,
6164 ) -> Self {
6265 Self {
6366 storage,
@@ -69,6 +72,7 @@ impl<P: Provider + Send + Sync + Clone + std::fmt::Debug + 'static> TaskManager<
6972 event_processor_config. max_metadata_tasks ,
7073 ) ) ,
7174 event_processor_config,
75+ nft_metadata_runtime,
7276 }
7377 }
7478
@@ -144,6 +148,7 @@ impl<P: Provider + Send + Sync + Clone + std::fmt::Debug + 'static> TaskManager<
144148 let event_processor_config = self . event_processor_config . clone ( ) ;
145149 let cache = self . cache . clone ( ) ;
146150 let nft_metadata_semaphore = self . nft_metadata_semaphore . clone ( ) ;
151+ let nft_metadata_runtime = self . nft_metadata_runtime . clone ( ) ;
147152
148153 self . task_network
149154 . process_tasks ( move |task_id, task_data| {
@@ -153,6 +158,7 @@ impl<P: Provider + Send + Sync + Clone + std::fmt::Debug + 'static> TaskManager<
153158 let event_processor_config = event_processor_config. clone ( ) ;
154159 let cache = cache. clone ( ) ;
155160 let nft_metadata_semaphore = nft_metadata_semaphore. clone ( ) ;
161+ let nft_metadata_runtime = nft_metadata_runtime. clone ( ) ;
156162
157163 async move {
158164 // Process all events for this task sequentially
@@ -209,6 +215,7 @@ impl<P: Provider + Send + Sync + Clone + std::fmt::Debug + 'static> TaskManager<
209215 config : event_processor_config. clone ( ) ,
210216 nft_metadata_semaphore : nft_metadata_semaphore. clone ( ) ,
211217 is_at_head : * is_at_head,
218+ nft_metadata_runtime : nft_metadata_runtime. clone ( ) ,
212219 } ;
213220
214221 // Record processor timing and success/error metrics
0 commit comments