[Zope] Generating unique keys

gtk gtk@well.com
Sat, 30 Oct 1999 06:25:10 +1000


> I guess I'm not sold on the whole "the one that tries to commit last will
> rollback and be reexecuted" thing.

Having just tried it: Zope doesn't do the re-execution for you.

    from xmlrpclib import Server
    from thread import *

    def testFunc():
        local='http://127.0.0.1:8080'
        shrub1=Server(local + '/shrub1')
        print shrub1.xmlrpc_manage_addNi('ni created by thread id %s' %
str(get_ident()))

    for i in range(5):
        start_new_thread(testFunc, () )

For three runs, I got eight new objects and seven tracebacks. Oddly enough,
I only got FOUR detected conflicts. Which, for anyone who hasn't forced one
yet, look like this in debug mode:

    1999-10-29T20:21:03 INFO(0) Z2 CONFLICT Competing writes at, \
    /shrub1/xmlrpc_manage_addNi

I might try importing thread and having Shrubbery create a lock object to
prevent this kind of thing.

Regards,
Garth.

--
<gtk@well.com>