Chris Withers wrote:
Andrew McLean wrote:
Any advice gratefully received.

I'd suggested moving to a ZODB version new enough to have MVCC support, which will likely make your problem go away...


I'm using v3.6. Unless I'm missing something, it's the most recent stable version.

Since my first post I tried another approach. Namely creating (and using) a new connection instance in the thread that raised the ReadConflictError exception. It "seems" to work, but I would like to understand this a bit better.

class Downloader(threading.Thread):
   """Downloader class to download urls"""
   def __init__(self, id, taskQueue, resultQueue, db): = id
       self.__taskQueue = taskQueue
       self.__resultQueue = resultQueue
       self.__db = db
   def connect(self):
       self.__results =['done']
   def run(self):
       while 1:
           # Get task from the queue
           task = self.__taskQueue.get()
           if (task[1] == 1) or (not self.done(task)):
               # ...
               self.__resultQueue.put((task, result))
   def done(self, task):
       while 1:
               return self.__results.has_key(task)
           except ReadConflictError:
print "*** ReadConflictError raised: Generate new connection to database ***" self.connect()

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -

Reply via email to