fix: fetch data directly from DB in OLAP functions (#2475)

This commit is contained in:
Kartikeya Hegde
2023-10-09 12:03:40 +05:30
committed by GitHub
parent 3f1e7c2152
commit 12b5341972
2 changed files with 46 additions and 74 deletions

View File

@ -224,15 +224,11 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
filters: &PaymentIntentFetchConstraints,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.filter_payment_intent_by_constraints(merchant_id, filters, storage_scheme)
.await
}
MerchantStorageScheme::RedisKv => Err(StorageError::KVError.into()),
}
self.router_store
.filter_payment_intent_by_constraints(merchant_id, filters, storage_scheme)
.await
}
#[cfg(feature = "olap")]
async fn filter_payment_intents_by_time_range_constraints(
&self,
@ -240,18 +236,13 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
time_range: &api_models::payments::TimeRange,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<PaymentIntent>, StorageError> {
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.filter_payment_intents_by_time_range_constraints(
merchant_id,
time_range,
storage_scheme,
)
.await
}
MerchantStorageScheme::RedisKv => Err(StorageError::KVError.into()),
}
self.router_store
.filter_payment_intents_by_time_range_constraints(
merchant_id,
time_range,
storage_scheme,
)
.await
}
#[cfg(feature = "olap")]
@ -261,14 +252,9 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
filters: &PaymentIntentFetchConstraints,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<(PaymentIntent, PaymentAttempt)>, StorageError> {
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.get_filtered_payment_intents_attempt(merchant_id, filters, storage_scheme)
.await
}
MerchantStorageScheme::RedisKv => Err(StorageError::KVError.into()),
}
self.router_store
.get_filtered_payment_intents_attempt(merchant_id, filters, storage_scheme)
.await
}
#[cfg(feature = "olap")]
@ -278,19 +264,13 @@ impl<T: DatabaseStore> PaymentIntentInterface for KVRouterStore<T> {
constraints: &PaymentIntentFetchConstraints,
storage_scheme: MerchantStorageScheme,
) -> error_stack::Result<Vec<String>, StorageError> {
match storage_scheme {
MerchantStorageScheme::PostgresOnly => {
self.router_store
.get_filtered_active_attempt_ids_for_total_count(
merchant_id,
constraints,
storage_scheme,
)
.await
}
MerchantStorageScheme::RedisKv => Err(StorageError::KVError.into()),
}
self.router_store
.get_filtered_active_attempt_ids_for_total_count(
merchant_id,
constraints,
storage_scheme,
)
.await
}
}