mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 17:37:00 +00:00
Merge pull request #2348 from hongwei1/develop
bugfix/move the future out of the cache
This commit is contained in:
commit
03a4f39b23
@ -3056,7 +3056,7 @@ object NewStyle extends MdcLoggable{
|
||||
|
||||
private[this] val endpointMappingTTL = APIUtil.getPropsValue(s"endpointMapping.cache.ttl.seconds", "0").toInt
|
||||
|
||||
def getEndpointMappings(bankId: Option[String], callContext: Option[CallContext]): OBPReturnType[List[EndpointMappingT]] = {
|
||||
def getEndpointMappings(bankId: Option[String], callContext: Option[CallContext]): OBPReturnType[List[EndpointMappingT]] = Future{
|
||||
import scala.concurrent.duration._
|
||||
|
||||
validateBankId(bankId, callContext)
|
||||
@ -3064,7 +3064,7 @@ object NewStyle extends MdcLoggable{
|
||||
var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)
|
||||
CacheKeyFromArguments.buildCacheKey {
|
||||
Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(endpointMappingTTL second) {
|
||||
Future{(EndpointMappingProvider.endpointMappingProvider.vend.getAllEndpointMappings(bankId), callContext)}
|
||||
{(EndpointMappingProvider.endpointMappingProvider.vend.getAllEndpointMappings(bankId), callContext)}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -360,7 +360,7 @@ object MappedMetrics extends APIMetrics with MdcLoggable{
|
||||
}
|
||||
|
||||
// TODO Cache this as long as fromDate and toDate are in the past (before now)
|
||||
override def getTopApisFuture(queryParams: List[OBPQueryParam]): Future[Box[List[TopApi]]] = {
|
||||
override def getTopApisFuture(queryParams: List[OBPQueryParam]): Future[Box[List[TopApi]]] = Future{
|
||||
/**
|
||||
* Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUU
|
||||
* is just a temporary value field with UUID values in order to prevent any ambiguity.
|
||||
@ -369,7 +369,7 @@ object MappedMetrics extends APIMetrics with MdcLoggable{
|
||||
*/
|
||||
var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)
|
||||
CacheKeyFromArguments.buildCacheKey {Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(cachedTopApis seconds){
|
||||
Future{
|
||||
{
|
||||
val fromDate = queryParams.collect { case OBPFromDate(value) => value }.headOption
|
||||
val toDate = queryParams.collect { case OBPToDate(value) => value }.headOption
|
||||
val consumerId = queryParams.collect { case OBPConsumerId(value) => value }.headOption.flatMap(consumerIdToPrimaryKey)
|
||||
@ -440,7 +440,7 @@ object MappedMetrics extends APIMetrics with MdcLoggable{
|
||||
}}
|
||||
|
||||
// TODO Cache this as long as fromDate and toDate are in the past (before now)
|
||||
override def getTopConsumersFuture(queryParams: List[OBPQueryParam]): Future[Box[List[TopConsumer]]] = {
|
||||
override def getTopConsumersFuture(queryParams: List[OBPQueryParam]): Future[Box[List[TopConsumer]]] = Future {
|
||||
/**
|
||||
* Please note that "var cacheKey = (randomUUID().toString, randomUUID().toString, randomUU
|
||||
* is just a temporary value field with UUID values in order to prevent any ambiguity.
|
||||
@ -449,7 +449,7 @@ object MappedMetrics extends APIMetrics with MdcLoggable{
|
||||
*/
|
||||
var cacheKey = (randomUUID().toString, randomUUID().toString, randomUUID().toString)
|
||||
CacheKeyFromArguments.buildCacheKey {Caching.memoizeSyncWithProvider(Some(cacheKey.toString()))(cachedTopConsumers seconds){
|
||||
Future {
|
||||
|
||||
val fromDate = queryParams.collect { case OBPFromDate(value) => value }.headOption
|
||||
val toDate = queryParams.collect { case OBPToDate(value) => value }.headOption
|
||||
val consumerId = queryParams.collect { case OBPConsumerId(value) => value }.headOption.flatMap(consumerIdToPrimaryKey)
|
||||
@ -519,7 +519,7 @@ object MappedMetrics extends APIMetrics with MdcLoggable{
|
||||
}
|
||||
tryo(result)
|
||||
}
|
||||
}}}
|
||||
}}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user