Refactor the functions in the routes modules to use web::block properly
Opened this issue · 0 comments
KevinCLydon commented
Functions in the routes modules are using web::block
improperly (I think). If my understanding is correct, they should ideally be written so that as much logic as possible is within a web::block
call. The function called within web::block
should return a Result
, and then converting that result into an HttpResponse
should be handled within calls to map
and map_err
on the future returned by web::block
. I think, without doing it that way, we are probably experiencing worse performance than we could have.