Comet fixes

This fixes a handful of bugs that when taken together kept things mostly working!

  - Unify lastListenerTime (which was previously always zero) with
    lastListenTime
  - Make lastRenderTime, delta timestamps, and lastListenerTime
    consistent with each other as they are directly compared
  - More accurately track whether any deltas have been sent
  - Pretend initial render happened at creation time to prevent a second
    render call from running on the initial Listen message
  - Rename devMode to alwaysReRenderOnPageLoad
It was recently added. I'm pretty confident it never worked (i.e. it's
always been a no-op). Basically we had both lastListenerTime and
lastListenTime. We were updating lastListenTime internally (i.e. that was
the "real" value), but exposing lastListenerTime externally (which was
always zero).

I think it's questionable to use lastListenerTime here (in other words, I
think the answer to your second question is "yes" :-)). lastListenerTime is
the timestamp of when the browser last connected to the server. If you have
multiple comet actors on a page, a push from one of them will result in a
response/re-connect cycle and lastListenerTime will be advanced for all of
the comet actors on the page. This could mean lost partial updates if a
partial update for another comet actor had been added in the meantime.

I don't think it's safe to prune partial updates like that regardless
though. With multiple comet actors on the page, you can have the following
situation (which we've actually seen):

1) browser connects to server
2) comet infrastructure sets up response handling actor and sends Listen
messages to comet actors
3) Comet actor #1 sends response
4) response handler actor prepares to send comet actor #1's response to
client by turning itself off and sending Unlisten messages to comet actors
5) Comet actor #2 sends response, but response handler actor has already
turned itself off (i.e. #2's response is ignored)
6) Unlisten message is processed by comet actors
7) response is sent to client

In a nutshell, it's hard to say for sure if a particular update has
actually made it to the client or not.



On Tue, Dec 2, 2014 at 10:01 PM, Antonio Salazar Cardozo <
notifications@github.com> wrote:

> In web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala:
>
> >        ca
> >      }
> >    }
> >
> > -
> > -  private def lastWhenDeltaPruner: (LiftCometActor, List[Delta]) => List[Delta] =
>
> Hmmm… So I get that this was a noop once upon a time, but getting rid of
> it seems like a bad idea. What particular behavior were you seeing? Does
> lastListenerTime not mean what we think it means?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/lift/framework/pull/1619/files#r21190949>.
>