« Return to Thread: implementing long poll in grails

Re: implementing long poll in grails

by Dave Crane-7 :: Rate this Message:

Reply to Author | View in Thread

Yes, probably - a straightforward save() did it for me, but I don't think that code ever got run outside of dev mode with the in-memory database. If I ever did deploy it against a real database, I'd probably find my mileage varying.

The interesting thing that came out of it for me was that my home-grown comet was falling foul of another standard assumption baked into Grails, and a lot of other web frameworks - namely that the entire request runs in a single transaction. This makes perfect sense when we assume that a request will be very short-lived, which is a good assumption to make until Comet comes along. There were other similar gotchas that came up during that code - Prototype's Ajax.Request classes make similar assumptions somewhere along the way, for one - reinforcing my point that trying to do it yourself is asking for trouble - although you learn quite a bit in the attempt :)

Cheers,

Dave

2009/7/3 Robert Fischer <robert.fischer@...>
Dave Crane wrote:
I did solve the original problem that I posted to the list - as I recall, I needed to explicitly call save() on domain classes before going to sleep so that other calls to the server would see them.


Getting back to the original version: you'll probably need a .save(flush:true).  And depending on the transaction settings on the DB, maybe a transaction commit.


~~ Robert Fischer, Smokejumper IT Consulting.
Enfranchised Mind Blog http://EnfranchisedMind.com/blog

Check out my book, "Grails Persistence with GORM and GSQL"!
http://www.smokejumperit.com/redirect.html

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email



 « Return to Thread: implementing long poll in grails