What's the best way to provide features which may ...
# ktor
m
What's the best way to provide features which may perform a lot of work (i.e. spend a lot of time suspended). Do I need to offload that to another dispatcher or can I just run it in the pipeline's own scope?
Copy code
pipeline.sendPipeline.intercept(ApplicationSendPipeline.Render) { subject ->
	if (subject is OutgoingContent) return@intercept

	launch(context = <http://Dispatchers.IO|Dispatchers.IO>) {
		proceedWith(feature.process(subject))
	}
}
c
There is no need to offload suspended work. This is the idea of coroutines. But it is better to offload long running blocking code
m
got it, thanks!