As far as I understand latest Slick documentation, there is no straight way to get results immediately from Slick queries, as they always return Future (wrapped, but still).
And liftweb requires database results here and now to render the pages.
So, what's the correct way to perform such tasks besides Await.result
?
Let's assume that we are talking about something like
"table.list" #> someDbRows.map
and not about ajax / comet which seems to be perfectly fit for Futures.
Thank you.
So, after some investigation, there seems to be no straight way to delegate CssSel answer to Future. The distinct cases are lift comet and lift REST. So, the only way to use Slick in a direct CssSel request is to Await.result
with reasonable timings.
Update: still, there is a way to use Futures in a righthand expression part and more in Lift 3.0 changes, thanks to Antonio Salazar Cardozo
There is a similar questions here: Background task in Liftweb environment and brief explanation https://groups.google.com/forum/#!topic/liftweb/zlNmSeboOGc
P.S.: Dear SO community, please stop farming reputation providing unrelated answers from top 3 google and raging when they gets down voted. I understand that SO slowly became HR hiring platform, but this is not why SO exists.