@@ -225,7 +225,10 @@ pub async fn process_message(state: Arc<State>, vaa_bytes: Vec<u8>) -> Result<()
225
225
) ?;
226
226
227
227
// Finally, store the resulting VAA in Hermes.
228
- store_vaa ( state. clone ( ) , vaa. sequence , vaa_bytes) . await ?;
228
+ let sequence = vaa. sequence ;
229
+ tokio:: spawn ( async move {
230
+ store_vaa ( state. clone ( ) , sequence, vaa_bytes) . await ;
231
+ } ) ;
229
232
230
233
Ok ( ( ) )
231
234
}
@@ -334,22 +337,24 @@ pub fn verify_vaa<'a>(
334
337
}
335
338
336
339
#[ tracing:: instrument( skip( state, vaa_bytes) ) ]
337
- pub async fn store_vaa ( state : Arc < State > , sequence : u64 , vaa_bytes : Vec < u8 > ) -> Result < ( ) > {
340
+ pub async fn store_vaa ( state : Arc < State > , sequence : u64 , vaa_bytes : Vec < u8 > ) {
338
341
// Check VAA hasn't already been seen, this may have been checked previously
339
- // but due to async nature It 's possible other threads have mutated the state
342
+ // but due to async nature it 's possible other threads have mutated the state
340
343
// since this VAA started processing.
341
344
let mut observed_vaa_seqs = state. observed_vaa_seqs . write ( ) . await ;
342
- ensure ! (
343
- !observed_vaa_seqs. contains( & sequence) ,
344
- "Previously observed VAA: {}" ,
345
- sequence,
346
- ) ;
345
+ if observed_vaa_seqs. contains ( & sequence) {
346
+ return ;
347
+ }
347
348
348
349
// Clear old cached VAA sequences.
349
350
while observed_vaa_seqs. len ( ) > OBSERVED_CACHE_SIZE {
350
351
observed_vaa_seqs. pop_first ( ) ;
351
352
}
352
353
353
354
// Hand the VAA to the aggregate store.
354
- crate :: aggregate:: store_update ( & state, crate :: aggregate:: Update :: Vaa ( vaa_bytes) ) . await
355
+ if let Err ( e) =
356
+ crate :: aggregate:: store_update ( & state, crate :: aggregate:: Update :: Vaa ( vaa_bytes) ) . await
357
+ {
358
+ tracing:: error!( error = ?e, "Failed to store VAA in aggregate store." ) ;
359
+ }
355
360
}
0 commit comments