[SIS-xxx] changing caching

prepare for release
This commit is contained in:
Sheldan
2023-12-01 23:38:38 +01:00
parent fa6333fa49
commit ce8341e69a
5 changed files with 15 additions and 11 deletions

View File

@@ -21,7 +21,7 @@ public class DebraDonationStatusController {
@GetMapping(value = "/latestDonations", produces = "application/json") @GetMapping(value = "/latestDonations", produces = "application/json")
public DonationStats getLatestDonations() { public DonationStats getLatestDonations() {
Long serverId = Long.parseLong(System.getenv(DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME)); Long serverId = Long.parseLong(System.getenv(DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME));
DonationsResponse donationResponse = donationService.getCachedDonationAmount(serverId); DonationsResponse donationResponse = donationService.getSynchronizedCachedDonationAmount(serverId);
List<DonationInfo> donations = donationService.getLatestDonations(donationResponse, Integer.MAX_VALUE) List<DonationInfo> donations = donationService.getLatestDonations(donationResponse, Integer.MAX_VALUE)
.stream() .stream()
.map(DonationInfo::fromDonationItemModel) .map(DonationInfo::fromDonationItemModel)
@@ -36,7 +36,7 @@ public class DebraDonationStatusController {
@GetMapping(value = "/highestDonations", produces = "application/json") @GetMapping(value = "/highestDonations", produces = "application/json")
public DonationStats getHighestDonations() { public DonationStats getHighestDonations() {
Long serverId = Long.parseLong(System.getenv(DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME)); Long serverId = Long.parseLong(System.getenv(DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME));
DonationsResponse donationResponse = donationService.getCachedDonationAmount(serverId); DonationsResponse donationResponse = donationService.getSynchronizedCachedDonationAmount(serverId);
List<DonationInfo> donations = donationService.getHighestDonations(donationResponse, Integer.MAX_VALUE) List<DonationInfo> donations = donationService.getHighestDonations(donationResponse, Integer.MAX_VALUE)
.stream() .stream()
.map(DonationInfo::fromDonationItemModel) .map(DonationInfo::fromDonationItemModel)
@@ -51,7 +51,7 @@ public class DebraDonationStatusController {
@GetMapping(value = "/campaignInfo", produces = "application/json") @GetMapping(value = "/campaignInfo", produces = "application/json")
public CampaignInfo getCampaignInfo() { public CampaignInfo getCampaignInfo() {
Long serverId = Long.parseLong(System.getenv(DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME)); Long serverId = Long.parseLong(System.getenv(DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME));
DonationsResponse donationResponse = donationService.getCachedDonationAmount(serverId); DonationsResponse donationResponse = donationService.getSynchronizedCachedDonationAmount(serverId);
Description pageObject = donationResponse.getPage(); Description pageObject = donationResponse.getPage();
return CampaignInfo return CampaignInfo

View File

@@ -134,9 +134,13 @@ public class DonationService {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
public synchronized DonationsResponse getSynchronizedCachedDonationAmount(Long serverId) {
return self.getCachedDonationAmount(serverId);
}
@Cacheable(value = "donation-cache") @Cacheable(value = "donation-cache")
public synchronized DonationsResponse getCachedDonationAmount(Long serverId) { public synchronized DonationsResponse getCachedDonationAmount(Long serverId) {
return fetchCurrentDonationAmount(serverId); return self.fetchCurrentDonationAmount(serverId);
} }
public DonationsResponse fetchCurrentDonationAmount(Long serverId) { public DonationsResponse fetchCurrentDonationAmount(Long serverId) {

View File

@@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.4.26 version: 1.4.27
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to # incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using. # follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes. # It is recommended to use it with quotes.
appVersion: "1.4.26" appVersion: "1.4.27"

View File

@@ -8,7 +8,7 @@ bot:
repository: harbor.sheldan.dev/sissi repository: harbor.sheldan.dev/sissi
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
image: sissi-bot image: sissi-bot
tag: 1.4.26 tag: 1.4.27
livenessProbe: livenessProbe:
initialDelaySeconds: 60 initialDelaySeconds: 60
periodSeconds: 5 periodSeconds: 5
@@ -25,7 +25,7 @@ restApi:
repository: harbor.sheldan.dev/sissi repository: harbor.sheldan.dev/sissi
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
image: sissi-rest-api image: sissi-rest-api
tag: 1.4.26 tag: 1.4.27
podAnnotations: {} podAnnotations: {}
podSecurityContext: {} podSecurityContext: {}
securityContext: {} securityContext: {}
@@ -74,7 +74,7 @@ templateDeploymentData:
repository: harbor.sheldan.dev/sissi repository: harbor.sheldan.dev/sissi
pullPolicy: Always pullPolicy: Always
image: sissi-template-data image: sissi-template-data
tag: 1.4.26 tag: 1.4.27
dbConfigDeployment: dbConfigDeployment:
enabled: true enabled: true
@@ -87,7 +87,7 @@ dbConfigDeploymentData:
repository: harbor.sheldan.dev/sissi repository: harbor.sheldan.dev/sissi
pullPolicy: Always pullPolicy: Always
image: sissi-db-data image: sissi-db-data
tag: 1.4.26 tag: 1.4.27
dbCredentials: dbCredentials:
host: host:

View File

@@ -1,2 +1,2 @@
REGISTRY_PREFIX=harbor.sheldan.dev/sissi/ REGISTRY_PREFIX=harbor.sheldan.dev/sissi/
VERSION=1.4.26 VERSION=1.4.27