I am also interested in what people think of this (so reviving this thread).
Lately I have been passing a
Job
in the constructor
Copy code
class SubService(job: Job, ...) { ... }
and I use
Job.invokeOnCompletion()
to clean up any resource in it. I also like this for error propagation (the whole service fails if a subservice fails). If I don't want this behavior, I can just wrap the job with a