dimsuz
05/27/2024, 1:01 PMisSubsystemFooInitialized(): Boolean
If these "query-like" methods go through a DB and they need to be non-blocking, I'm tempted to make them suspend, but then this has the effect that client can call them in whatever corotuine scope they like, outside of Service's lifecycle (which may or may not be a problem), and the API of the service becomes not uniform: it partly manages its operations in its own scope, but these "suspend" parts are kinda "leaking".
I could turn them into "reactive" properties Flow<Boolean> but this feels a bit like an overkill.
Maybe someone has thoughts on how to approach this?Sam
05/27/2024, 1:07 PMsuspend fun foo() {
myScope.async { getFoo() }.await()
}Sam
05/27/2024, 1:09 PMdimsuz
05/27/2024, 1:29 PMlaunch-es) with suspend-functions.
These functions also feel like they are a part of the service, because they are related to what it does, so it makes sense to keep them as methods. But maybe it's still a sign that they belong elsewhere 🤔