Skip to content
Snippets Groups Projects
Unverified Commit bae3e621 authored by Jakob Möller's avatar Jakob Möller Committed by GitHub
Browse files

Throw Exception in case we have a failed entry to ensure Abortion of the...

Throw Exception in case we have a failed entry to ensure Abortion of the Transaction (EXPOSUREAPP-2405) (#1134)

* Throw Exception in case we have a failed entry to ensure Abortion of the Transaction.

Signed-off-by: default avatard067928 <jakob.moeller@sap.com>

* Adjust test to not expect call to clear cache files

Signed-off-by: default avatard067928 <jakob.moeller@sap.com>
parent 59c99072
No related branches found
No related tags found
No related merge requests found
...@@ -37,6 +37,7 @@ import kotlinx.coroutines.awaitAll ...@@ -37,6 +37,7 @@ import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import timber.log.Timber import timber.log.Timber
import java.io.File import java.io.File
import java.io.IOException
import java.util.Collections import java.util.Collections
import java.util.Date import java.util.Date
import java.util.UUID import java.util.UUID
...@@ -121,7 +122,10 @@ object CachedKeyFileHolder { ...@@ -121,7 +122,10 @@ object CachedKeyFileHolder {
deferredQueries.awaitAll() deferredQueries.awaitAll()
Timber.v("${failedEntryCacheKeys.size} failed entries ") Timber.v("${failedEntryCacheKeys.size} failed entries ")
// For an error we clear the cache to try again // For an error we clear the cache to try again
keyCache.clear(failedEntryCacheKeys) if (failedEntryCacheKeys.isNotEmpty()) {
keyCache.clear(failedEntryCacheKeys)
throw IOException("failed to download all key files, at least one failing request.")
}
keyCache.getFilesFromEntries() keyCache.getFilesFromEntries()
.also { it.forEach { file -> Timber.v("cached file:${file.path}") } } .also { it.forEach { file -> Timber.v("cached file:${file.path}") } }
} }
......
...@@ -38,7 +38,6 @@ class CachedKeyFileHolderTest { ...@@ -38,7 +38,6 @@ class CachedKeyFileHolderTest {
every { KeyCacheRepository.getDateRepository(any()) } returns keyCacheRepository every { KeyCacheRepository.getDateRepository(any()) } returns keyCacheRepository
mockkObject(CachedKeyFileHolder) mockkObject(CachedKeyFileHolder)
coEvery { keyCacheRepository.deleteOutdatedEntries(any()) } just Runs coEvery { keyCacheRepository.deleteOutdatedEntries(any()) } just Runs
coEvery { keyCacheRepository.clear(any()) } just Runs
} }
/** /**
...@@ -65,7 +64,6 @@ class CachedKeyFileHolderTest { ...@@ -65,7 +64,6 @@ class CachedKeyFileHolderTest {
keyCacheRepository.deleteOutdatedEntries(any()) keyCacheRepository.deleteOutdatedEntries(any())
CachedKeyFileHolder["getMissingDaysFromDiff"](arrayListOf<String>()) CachedKeyFileHolder["getMissingDaysFromDiff"](arrayListOf<String>())
keyCacheRepository.getDates() keyCacheRepository.getDates()
keyCacheRepository.clear(emptyList())
keyCacheRepository.getFilesFromEntries() keyCacheRepository.getFilesFromEntries()
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment