Closed atoulme closed 5 years ago
So I purposefully didn’t have KV implement the CoroutineScope, as the cancellation scope for those async methods is outside the lifetime of the service.
But agree that using GlobalScope is wrong. It should ideally be the scope of the caller.
Hard to get a context in Java though?
OK, I have scaled back the changes back to just adding RocksDB. Should be good to go.
Hard to get a context in Java though?
Right. Hence I went with global scope. If you want cancellation scoping, you should be in Kotlin using the suspend methods anyway.
Also have KVs implement their own CoroutineScope, similar to DiscoveryService, so we don't use GlobalScope in async methods.