Skip to content

Commit

Permalink
Merge pull request #1797 from RADAR-base/clean-up-health
Browse files Browse the repository at this point in the history
Remove separate health cache
  • Loading branch information
mpgxvii committed May 7, 2024
2 parents 8d2eca4 + 3bb7bfa commit 9b74d7e
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 48 deletions.
1 change: 0 additions & 1 deletion src/app/core/services/config/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ export class ConfigService {
languagesSelectable: this.localization.getLanguageSettings(),
language: Promise.resolve(this.localization.getLanguage()),
cacheSize: this.kafka.getCacheSize(),
healthCacheSize: this.kafka.getHealthCacheSize(),
lastUploadDate: this.kafka.getLastUploadDate(),
lastNotificationUpdate: this.notifications.getLastNotificationUpdate()
}
Expand Down
29 changes: 1 addition & 28 deletions src/app/core/services/kafka/cache.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class CacheService {
) {}

init() {
return Promise.all([this.setCache({}), this.setHealthCache({})])
return Promise.all([this.setCache({})])
}

storeInCache(type, kafkaObject: KafkaObject, cacheValue: any) {
Expand Down Expand Up @@ -76,29 +76,6 @@ export class CacheService {
})
}

removeFromHealthCache(cacheKeys: number[]) {
if (!cacheKeys.length) return Promise.resolve()
// return this.healthStore
// .remove(cacheKeys)
// .then(() => this.setLastUploadDate(Date.now()))
}

setHealthCache(cache) {
// return this.healthStore.set(StorageKeys.CACHE_ANSWERS, cache)
}

getHealthCache() {
return Promise.resolve()
// return this.healthStore.get(this.KAFKA_STORE.CACHE_ANSWERS).then(data => {
// return Object.keys(data)
// .slice(0, this.HEALTH_CACHE_LIMIT)
// .reduce((result, key) => {
// result[key] = data[key]
// return result
// }, {})
// })
}

setCache(cache) {
return this.storage.set(this.KAFKA_STORE.CACHE_ANSWERS, cache)
}
Expand All @@ -119,10 +96,6 @@ export class CacheService {
return this.storage.get(this.KAFKA_STORE.LAST_UPLOAD_DATE)
}

getHealthCacheSize() {
return
}

getCacheSize() {
return this.storage
.get(this.KAFKA_STORE.CACHE_ANSWERS)
Expand Down
12 changes: 0 additions & 12 deletions src/app/core/services/kafka/kafka.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ export class KafkaService {
.then(() =>
this.cache
.removeFromCache(successKeys)
.then(() => this.cache.removeFromHealthCache(successKeys))
.then(() => {
this.cache.setCacheSending(false)
return { successKeys, failedKeys }
Expand Down Expand Up @@ -255,13 +254,6 @@ export class KafkaService {
.toPromise()
}

removeFromHealthCache(cacheKeys: number[]) {
// if (!cacheKeys.length) return Promise.resolve()
// return this.storage
// .removeHealthData(cacheKeys)
// .then(() => this.setLastUploadDate(Date.now()))
}

getAccessToken() {
return Promise.all([this.updateURI(), this.token.refresh()])
.then(() => this.token.getTokens())
Expand Down Expand Up @@ -301,10 +293,6 @@ export class KafkaService {
return this.cache.getLastUploadDate()
}

getHealthCacheSize() {
return this.cache.getHealthCacheSize()
}

getCacheSize() {
return this.cache.getCacheSize()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@
{{ settings.cacheSize }}
</span>
</ion-item>
<ion-item lines="full">
{{ 'SETTINGS_HEALTH_CACHE_SIZE' | translate }}
<span slot="end" class="info-value">
{{ settings.healthCacheSize }}
</span>
</ion-item>
<ion-item lines="full">
{{ 'SETTINGS_LAST_UPLOAD_TO_SERVER' | translate }}
<span slot="end" class="info-value">
Expand Down
1 change: 0 additions & 1 deletion src/app/shared/models/settings.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export interface Settings {
appVersion?: string
cacheSize?: number
healthCacheSize?: number
scheduleVersion?: string
participantLogin?: string
participantID?: string
Expand Down

0 comments on commit 9b74d7e

Please sign in to comment.