mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 19:36:50 +00:00
feature/Tweak the default value of retain_archive_metrics_days
This commit is contained in:
parent
ffc91866be
commit
0331ce65c8
@ -1207,7 +1207,8 @@ user_account_validated_redirect_url =
|
||||
user_account_is_validated = false
|
||||
|
||||
# Defines the number of days we keep rows in the table "MetricsArchive"
|
||||
retain_archive_metrics_days = 365
|
||||
# default value is 3 years
|
||||
retain_archive_metrics_days = 1095
|
||||
|
||||
# Defines the number of days we keep rows in the table "Metric" former "MappedMetric"
|
||||
retain_metrics_days = 60
|
||||
@ -61,7 +61,11 @@ object MetricsArchiveScheduler extends MdcLoggable {
|
||||
|
||||
def deleteOutdatedRowsFromMetricsArchive() = {
|
||||
val currentTime = new Date()
|
||||
val days = APIUtil.getPropsAsLongValue("retain_archive_metrics_days", 365)
|
||||
val defaultValue : Int = 365 * 3
|
||||
val days = APIUtil.getPropsAsLongValue("retain_archive_metrics_days", defaultValue) match {
|
||||
case days if days > 364 => days
|
||||
case _ => 365
|
||||
}
|
||||
val oneYearAgo: Date = new Date(currentTime.getTime - (oneDayInMillis * days))
|
||||
// Delete the outdated rows from the table "MetricsArchive"
|
||||
MetricsArchive.bulkDelete_!!(By_<=(MetricsArchive.date, oneYearAgo))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user