mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-11-01 02:57:02 +08:00 
			
		
		
		
	db: Added Reverse lookup table (#147)
This commit is contained in:
		| @ -25,7 +25,7 @@ async fn drainer_handler( | ||||
|     stream_index: u8, | ||||
|     max_read_count: u64, | ||||
| ) -> errors::DrainerResult<()> { | ||||
|     let stream_name = utils::get_drainer_stream(store.clone(), stream_index); | ||||
|     let stream_name = utils::get_drainer_stream_name(store.clone(), stream_index); | ||||
|     let drainer_result = drainer(store.clone(), max_read_count, stream_name.as_str()).await; | ||||
|  | ||||
|     if let Err(_e) = drainer_result { | ||||
| @ -70,6 +70,9 @@ async fn drainer( | ||||
|                 kv::Insertable::PaymentAttempt(a) => { | ||||
|                     macro_util::handle_resp!(a.insert(&conn).await, "ins", "pa") | ||||
|                 } | ||||
|                 kv::Insertable::Refund(a) => { | ||||
|                     macro_util::handle_resp!(a.insert(&conn).await, "ins", "ref") | ||||
|                 } | ||||
|             }, | ||||
|             kv::DBOperation::Update { updatable } => match updatable { | ||||
|                 kv::Updateable::PaymentIntentUpdate(a) => { | ||||
| @ -78,6 +81,9 @@ async fn drainer( | ||||
|                 kv::Updateable::PaymentAttemptUpdate(a) => { | ||||
|                     macro_util::handle_resp!(a.orig.update(&conn, a.update_data).await, "up", "pa") | ||||
|                 } | ||||
|                 kv::Updateable::RefundUpdate(a) => { | ||||
|                     macro_util::handle_resp!(a.orig.update(&conn, a.update_data).await, "up", "ref") | ||||
|                 } | ||||
|             }, | ||||
|             kv::DBOperation::Delete => todo!(), | ||||
|         }; | ||||
|  | ||||
| @ -113,9 +113,9 @@ pub fn increment_stream_index(index: u8, total_streams: u8) -> u8 { | ||||
| } | ||||
|  | ||||
| pub(crate) fn get_stream_key_flag(store: Arc<router::services::Store>, stream_index: u8) -> String { | ||||
|     format!("{}_in_use", get_drainer_stream(store, stream_index)) | ||||
|     format!("{}_in_use", get_drainer_stream_name(store, stream_index)) | ||||
| } | ||||
|  | ||||
| pub(crate) fn get_drainer_stream(store: Arc<Store>, stream_index: u8) -> String { | ||||
|     store.drainer_stream(format!("shard_{}", stream_index).as_str()) | ||||
| pub(crate) fn get_drainer_stream_name(store: Arc<Store>, stream_index: u8) -> String { | ||||
|     store.get_drainer_stream_name(format!("shard_{}", stream_index).as_str()) | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Kartikeya Hegde
					Kartikeya Hegde