I’ve actually been working on something specifically for Ktor but it’s leveraging structured concurrency instead. I’m still in the process of writing documentation today, and will make a first stable release this week.
https://github.com/arrow-kt/suspendapp
There is several ways to leverage it, but together with this ticket it would be really nice since it would allow you to leverage the
and reason about graceful shutdown in terms of structured concurrency.
It’s being developed outside of the Ktor context, since it’s also interesting to use in combination with for example Kafka streaming if you want to guarantee offsets being committed before shutdown on