George Gozadinos wrote:
Hi,
I'm developing a kss-based live chat product to be released as open source.
While the basic functionality is working, I have the following problem.
I would like to avoid storing messages sent by users to the chat room object, as this easily leads to ZODB conflicts. But I need a thread- safe way to store this messages. There are alternatives such as using sql or some external xmlrpc server but is there a way to actually store them in memory AND have them available to all threads? Is threading.lock possible and if yes any examples of use within zope?

If you just want them in memory, then using a module-level variable as the actual storage should work. You'll need to implement some thread locking though - e.g. using zope.thread the Python threading module - to avoid write conflicts there. If you're not doing anything complex (e.g. you're just writing to a simple data structure) then that should work reasonably well.

Martin

--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book


_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to