Thanks for the advice, I'll definitely rethink the pattern. I'm actually seeing the problem when I use RunWebApp. When I press a key RunWebApp should shut down but it just hangs for me.
bearfeeder wrote: > > On Thu, Feb 4, 2010 at 2:31 PM, Channing Walton > <[email protected]>wrote: > >> Actually I'm seeing the same thing with RunWebApp. Methinks there is a >> problem with my comet, I copied the pattern from somewhere else so it may >> well be wrong. Here it is: >> >> (apologies for the names - imagination is escaping me) >> >> class NewIssuesPump extends CometActor { >> >> def render = >> <div id="recent_deals"> >> <ul> >> { Deal.recentDeals.map(d => <li>{d.name} >> {d.created.asHtml}</li>) } >> > > I would recommend against this pattern. It's less than optimal to make an > external call during the render process. > > It's much better to send the recentDeals data to the CometActor via a > message. That way, the CometActor isn't blocking on the RDBMS and you > don't > have 20 or 50 different CometActors all making the same RDBMS call at > once. > > The Tick pattern is only good for a clock... it's very bad for other > patterns. > > But this is not causing the problem (unless the query is taking a minute). > > If you can tell me how the Jetty process is getting the message to > shutdown, > I'll try to reproduce the issue. > > >> </ul> >> </div> >> >> override def lowPriority = { >> case Tick => reRender(false) >> } >> >> override def localSetup { >> super.localSetup() >> NewIssuesPumpMaster ! SubscribePump(this) >> } >> >> override def localShutdown { >> NewIssuesPumpMaster ! UnsubPump(this) >> super.localShutdown() >> } >> } >> >> case object Tick >> case class SubscribePump(pump : NewIssuesPump) >> case class UnsubPump(pump: NewIssuesPump) >> >> object NewIssuesPumpMaster extends LiftActor { >> >> private var pumps : List[NewIssuesPump] = Nil >> >> override def messageHandler = { >> case SubscribePump(pump) => pumps ::= pump >> case UnsubPump(pump) => pumps -= pump >> case Tick => pumps.foreach(_ ! Tick) >> } >> } >> >> -- >> View this message in context: >> http://old.nabble.com/Comet-making-jetty-take-a-long-time-to-shutdown-tp27450451p27460808.html >> Sent from the liftweb mailing list archive at Nabble.com. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Lift" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<liftweb%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/liftweb?hl=en. >> >> > > > -- > Lift, the simply functional web framework http://liftweb.net > Beginning Scala http://www.apress.com/book/view/1430219890 > Follow me: http://twitter.com/dpp > Surf the harmonics > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/liftweb?hl=en. > > > -- View this message in context: http://old.nabble.com/Comet-making-jetty-take-a-long-time-to-shutdown-tp27450451p27461062.html Sent from the liftweb mailing list archive at Nabble.com. -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
