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

Switch Exception Throwing of the enabledCheck in the RetrieveDiagnosisKeysTransaction.kt (#799)


Fixes #770

Signed-off-by: default avatard067928 <jakob.moeller@sap.com>
parent dc91ff81
No related branches found
No related tags found
No related merge requests found
...@@ -116,6 +116,16 @@ object RetrieveDiagnosisKeysTransaction : Transaction() { ...@@ -116,6 +116,16 @@ object RetrieveDiagnosisKeysTransaction : Transaction() {
/** initiates the transaction. This suspend function guarantees a successful transaction once completed. */ /** initiates the transaction. This suspend function guarantees a successful transaction once completed. */
suspend fun start() = lockAndExecuteUnique { suspend fun start() = lockAndExecuteUnique {
/**
* Handles the case when the ENClient got disabled but the Transaction is still scheduled
* in a background job. Also it acts as a failure catch in case the orchestration code did
* not check in before.
*/
if (!InternalExposureNotificationClient.asyncIsEnabled()) {
Timber.w("EN is not enabled, skipping RetrieveDiagnosisKeys")
executeClose()
return@lockAndExecuteUnique
}
/**************************************************** /****************************************************
* INIT TRANSACTION * INIT TRANSACTION
****************************************************/ ****************************************************/
...@@ -193,8 +203,6 @@ object RetrieveDiagnosisKeysTransaction : Transaction() { ...@@ -193,8 +203,6 @@ object RetrieveDiagnosisKeysTransaction : Transaction() {
* Executes the INIT Transaction State * Executes the INIT Transaction State
*/ */
private suspend fun executeSetup() = executeState(SETUP) { private suspend fun executeSetup() = executeState(SETUP) {
if (!InternalExposureNotificationClient.asyncIsEnabled())
throw IllegalStateException("The Exposure Notification Framework must be active, check your tracing status")
lastFetchDateForRollback.set(LocalData.lastTimeDiagnosisKeysFromServerFetch()) lastFetchDateForRollback.set(LocalData.lastTimeDiagnosisKeysFromServerFetch())
val currentDate = Date(System.currentTimeMillis()) val currentDate = Date(System.currentTimeMillis())
Timber.d("using $currentDate as current date in Transaction.") Timber.d("using $currentDate as current date in Transaction.")
......
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