Skip to content

Commit

Permalink
suppress the exception due to missing scope (PolymerLabs#6072)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianull authored Sep 4, 2020
1 parent cfe5ed2 commit 5951204
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions java/arcs/core/storage/DirectStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,13 @@ class DirectStore<Data : CrdtData, Op : CrdtOperation, T> /* internal */ constru
stateChannel.close()
state.value = State.Closed()
closeWriteBack()
requireNotNull(scope) {
"store driver cannot be closed properly due to missing coroutine scope"
}.run {
launch { driver.close() }
}

/**
* The [scope] was initialized and assigned at the [StorageService.onBind], hence
* the [driver.close] would only take effect in real use-cases / integration tests
* but unit tests which don't spin up entire storage service stack.
*/
scope?.launch { driver.close() }
}
}

Expand Down

0 comments on commit 5951204

Please sign in to comment.