We need to handle missing requests in buildDeferredFunction

Visto 29 veces
Saltar al primer mensaje no leído

ari gold

no leída,
3 abr 2017, 17:58:343/4/17
a Lift
Allo,

We ran across an issue where S.req returns a Req without a HTTPRequest inside. Ergo, when we call HttpRequest.snapshot in Req.snapshot, we get a NPE. The basic question is what to do with Req when you're in a comet context.

To fix this, we modified currentReq in both definitions of buildDeferredFunction so that they filter out null requests:

val currentReq = S.request.filter(_.request != null).map(_.snapshot)

What's the best way to handle this? Submit a PR?

Thanks y'all,

Ari

Antonio Salazar Cardozo

no leída,
4 abr 2017, 8:58:184/4/17
a Lift
Methinks a PR would be bomb, but first a Github issue!

To clarify here, the situation is basically:

 - Someone sends a message to a comet.
 - We try to create a deferred function (in this case, it's for the future-with-session
   helpers that Piotr created) for lazy-loading.
 - The deferred function builder tries to snapshot the current HTTPRequest.
 - That object is null (due to being in a comet context), and things go boom.

Correct?
Thanks,
Antonio

Matt Farmer

no leída,
13 jun 2017, 10:14:3113/6/17
a Lift
Just to complete the thread here, this has been fixed and merged for 3.1.0-RC1.

And congratulations to Ari on his first contribution to Lift!

Antonio Salazar Cardozo

no leída,
13 jun 2017, 13:46:2913/6/17
a Lift
Yay! 🎉

ari gold

no leída,
13 jun 2017, 16:32:0213/6/17
a Lift
Grazie!

Sure y'all did between 95-99% of the thinking but damn I'll take it! :D

'gotta start somewhere 💪!
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos