Skip to content

Commit

Permalink
Don't suspend requests too early for the first request.
Browse files Browse the repository at this point in the history
We were suspending the request before we got a chance to kick off the
processing for the actual response to be run.
  • Loading branch information
Shadowfiend committed Aug 18, 2012
1 parent 7d89340 commit 70ffcba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions web/webkit/src/main/scala/net/liftweb/http/LiftServlet.scala
Expand Up @@ -626,8 +626,6 @@ class LiftServlet extends Loggable {
(renderVersion ->
AjaxRequestInfo(handlerVersion, Empty, cont :: Nil, millis))

suspendRequest()

Empty // no response available, triggers the actual AJAX computation below

case AjaxRequestInfo(storedVersion, existingResponseBox @ Full(_), _, _) =>
Expand All @@ -646,14 +644,12 @@ class LiftServlet extends Loggable {
(renderVersion ->
AjaxRequestInfo(handlerVersion, Empty, cont :: Nil, millis))

suspendRequest()

Empty // no response available, triggers the actual AJAX computation below
}
}

toReturn or {
Full(runAjax(requestState, liftSession, Full((result: LiftResponse) => {
val result = Full(runAjax(requestState, liftSession, Full((result: LiftResponse) => {
// When we get the response, synchronizedly check that the
// versions are still the same in the map, and, if so, update
// any waiting actors then clear the actor list and update the
Expand All @@ -669,6 +665,10 @@ class LiftServlet extends Loggable {
}
}
})))

suspendRequest()

result
} openOr Empty

case _ =>
Expand Down
Expand Up @@ -573,7 +573,7 @@ class LiftSession(private[http] val _contextPath: String, val uniqueId: String,
*/
private var ajaxRequests = scala.collection.mutable.Map[String,AjaxRequestInfo]()

private[http] def withAjaxRequests[T](fn: (scala.collection.mutable.Map[String, AjaxRequestInfo]) => T) = {
private[http] def withAjaxRequests[T](fn: (scala.collection.mutable.Map[String, AjaxRequestInfo]) => T): T = {
ajaxRequests.synchronized { fn(ajaxRequests) }
}

Expand Down

0 comments on commit 70ffcba

Please sign in to comment.