Hi.
There are two timeouts I'm conserned about:
I propose extending LiftCometActor with the following methods to be able to react to comet-timeouts.
1) def renderTimeoutHandler(): Box[NodeSeq] = Empty
2) def cometTimeoutHandler(): JsCmd = Noop
1) is used in Comet.scala(75-80) like this:
case e =>
if (c.renderTimeoutHandler().isDefined) {
c.renderTimeoutHandler().open_!
} else {
throw new CometTimeoutException("type: "+theType+" name: "+name)
}
2) is used in LiftSession.scala(60-667) like this:
case Full(id) if asyncById.contains(id) => asyncById.get(id).toList.flatMap(a =>
a.!?(a.cometProcessingTimeout, ActionMessageSet(f.map(i => buildFunc(i)), state)) match {
case Full(li: List[_]) => li
case li: List[_] => li
case Empty => Full(a.cometTimeoutHandler())
case other => Nil
})
case _ => f.map(i => buildFunc(i).apply())
@dpp; I know you don't like calling methods on actors like the above code does:-), but I see it's done elsewhere in the codebase in cases like this and I don't see how it might break things.
An example of customising in a comet-actor is:
override def renderTimeoutHandler(): Box[NodeSeq] = {
Full(<div>Comet {this.getClass} timed out (timeout is {cometRenderTimeout}ms)</div>)
}
override def cometTimeoutHandler(): JsCmd = {
Alert("Timout, exceeded " + cometProcessingTimeout + "ms")
}
I've not created a ticket for this as I want to have a discussion on it first, and comments on method-signatures.
What you think?
--
Andreas Joseph Krogh <and...@officenet.no> - mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc
An example of customising in a comet-actor is:
override def renderTimeoutHandler(): Box[NodeSeq] = {
Full(<div>Comet {this.getClass} timed out (timeout is {cometRenderTimeout}ms)</div>)
}override def cometTimeoutHandler(): JsCmd = {
Alert("Timout, exceeded " + cometProcessingTimeout + "ms")
}
I've not created a ticket for this as I want to have a discussion on it first, and comments on method-signatures.
What you think?
--
Andreas Joseph Krogh <and...@officenet.no> - mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
But beyond that reason, these methods mask a design flaw and they encourage masking the design flaw. If there's a long delay in handling something on the Actor thread, there's a huge problem in the code. Creating easy ways to work around this encourages ignoring the problem. It's like declaring "throws Exception" in every method in Java code. You're just displacing the problem rather than handling it correctly. The correct way to handle long running processes is to use a thread pool and then send a message back to the Actor.
The developer in development mode should be alerted to the issue (the big red box alerts the developer to the issue, but there's no obvious message for the Ajax timeout).
But this issue should be addressed by helping the developer use the Actor threading paradigm correctly rather than masking issues.
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
Ok, great:-) Anyone else wants this in?
On 12/12/2011 11:32 PM, David Pollak wrote:Ok, great:-) Anyone else wants this in?
> Okay.
>
> I've vote + 1/2 on this... I'm not 100% keen on it, but you've done an
> excellent job of thinking it through and documenting it.
--
Andreas Joseph Krogh <and...@officenet.no> - mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc
På tirsdag 13. desember 2011 kl 05:19:20 skrev Sergey Trofimov <sergey....@gmail.com>:
On Tue, Dec 13, 2011 at 01:37, Andreas Joseph Krogh <and...@officenet.no> wrote:
On 12/12/2011 11:32 PM, David Pollak wrote:Ok, great:-) Anyone else wants this in?
> Okay.
>
> I've vote + 1/2 on this... I'm not 100% keen on it, but you've done an
> excellent job of thinking it through and documenting it.
yes :-)
Great:-)
What's the policy on implementing stuff which only gets 1/2 a vote (in addition to mine of corse)? I'd really like to see this in 2.4-RC1 which Indrajit is about to tag...
--
På torsdag 15. desember 2011 kl 11:16:28 skrev Indrajit Raychaudhuri <indr...@gmail.com>:
Andreas, If you can have another associated ticket to have a more organized fix for this in 2.5 timeframe, you have my vote.Please push this to master. I'll cherry pick this and spin RC1 in the morning.
What do you mean by associated ticket? Shall I create another ticket *in addition* to the one describing this feature (which I just created now: https://www.assembla.com/spaces/liftweb/tickets/1162-react-to-comet-timeout--both-render-and-ajax) so we can recap in 2.5 and improve the solution?
I'm ready to push to master but await your answer.
On Thursday 15 December 2011 at 4:10 PM, Andreas Joseph Krogh wrote:
På torsdag 15. desember 2011 kl 11:16:28 skrev Indrajit Raychaudhuri <indr...@gmail.com>:
Andreas, If you can have another associated ticket to have a more organized fix for this in 2.5 timeframe, you have my vote.Please push this to master. I'll cherry pick this and spin RC1 in the morning.What do you mean by associated ticket? Shall I create another ticket *in addition* to the one describing this feature (which I just created now: https://www.assembla.com/spaces/liftweb/tickets/1162-react-to-comet-timeout--both-render-and-ajax) so we can recap in 2.5 and improve the solution?
I'm ready to push to master but await your answer.
--
Andreas Joseph Krogh <and...@officenet.no> - mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc
--
På torsdag 15. desember 2011 kl 13:13:58 skrev Indrajit Raychaudhuri <indr...@gmail.com>:
On Thursday 15 December 2011 at 4:10 PM, Andreas Joseph Krogh wrote:
På torsdag 15. desember 2011 kl 11:16:28 skrev Indrajit Raychaudhuri <indr...@gmail.com>:
Andreas, If you can have another associated ticket to have a more organized fix for this in 2.5 timeframe, you have my vote.Please push this to master. I'll cherry pick this and spin RC1 in the morning.What do you mean by associated ticket? Shall I create another ticket *in addition* to the one describing this feature (which I just created now: https://www.assembla.com/spaces/liftweb/tickets/1162-react-to-comet-timeout--both-render-and-ajax) so we can recap in 2.5 and improve the solution?
Yes please, another ticket in addition to #1162 so that we can have an improved and structured fix in 2.5 :)
Done, and pushed #1162 to master.