Using ElementTree as backend for a chat web application issues
gagsl-py2 at yahoo.com.ar
Wed Jun 11 05:47:54 CEST 2008
En Mon, 09 Jun 2008 15:32:00 -0300, Marcelo de Moraes Serpa
<celoserpa at gmail.com> escribió:
> I've built a chat with a front-end Ajax client and backend usign
> to persist the data.
> In some circunstances I could not yet discover (it seems random) when I
> edit/save the structure, the structure gets corrupted, elementree seems
> get lost in its internal "cursor", usually something like this happens:
> <chat id="1">
> <chat id="2">
> Pretty strange, and it drives the whole application unusable.
> I don't know if the concurrent nature of the application (multiple users
> using the client at almost the same time and sending data to the server
> which in turn must save the data to the same global.xml file) has
> to do with it - I don't know if ElementTree is suitable for this kind of
> thing. How to hanlde this concurrent issue?
I don't think it's a problem with ElementTree. Perhaps you are writing the
same (global) configuration file from several threads at the same time?
You may need some locking mechanism in that case.
More information about the Python-list