Jonathan wrote:
----- Original Message ----- From: "David H" <bluepaul@earthlink.net> To: "Jonathan" <dev101@magma.ca> Cc: <dieter@handshake.de>; <zope@zope.org> Sent: Wednesday, July 05, 2006 3:00 PM Subject: Re: [Zope] Trying to trap ConflictError
Jonathan wrote:
----- Original Message ----- From: <dieter@handshake.de> To: "Jonathan" <dev101@magma.ca> Cc: "Dennis Allison" <allison@shasta.stanford.edu>; <zope@zope.org> Sent: Wednesday, July 05, 2006 2:28 PM Subject: Re: [Zope] Trying to trap ConflictError
Jonathan wrote at 2006-7-4 13:46 -0400:
... The image objects stored in TemporaryStorage are never overwritten, edited etc (which is causing me some confusion as to why the conflict errors are occurring)
The error message tells your that the conflict is not caused by the modification of the image but the container holding your image.
"BTreeFolder" already do conflict resolution -- and reduce the conflict probability by about a factor of 30 to 100 (depending on type).
However, if several threads should try to add elements with the same id, then the conflict resolution cannot work. Maybe, that happens in your case?
The id for the image object is generated by the following code:
def MakeId(): time.sleep(.01) ts = string.replace(str(time.time()),'.', '') # remove floating point '.' char return ts[-10:]
So there should not be any collision of ids.
I am still investing, and have found errors like:
Jonathan,
I wouldn't feel safe with that. Why not append a few random digits just to be safe?
I am relatively new to python, so if there is something problematic with my use of the time module to create unique ids, please let me know! (just adding random digits seems a bit kludgy?!)
Thanks,
Jonathan
Hi Jonathan, I figured that if conflicts occur because mutliple processes are requesting some service at the same time +- delta then simply generating a file name based on the time was suspect. David David