Dennis Schröder
04/17/2020, 3:20 PM@RestController
class PageController(
private val pageService: PageService,
) {
private val context = <http://Dispatchers.IO|Dispatchers.IO>
@GetMapping(PAGES_BY_SLUG)
suspend fun getPage(
@PathVariable slug: String,
): PageResponse =
withContext(context) { pageService.getPage(slug) }
}
}
My motivation is to keep the webflux threadpool clean from everything that does not relate to the request till it reaches the controller.
But does really have an positiv affect on performance? Or does the context switch here is even bad because it comes with an cost?kenkyee
04/19/2020, 10:30 AMDennis Schröder
04/22/2020, 9:39 PM<http://Dispatchers.IO|Dispatchers.IO>