Bugs item #3525829, was opened at 2012-05-11 06:34
Message generated for change (Comment added) made by ljsilver
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3525829&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: General
Group: SQLObject from repository
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: LJSilver (ljsilver)
Assigned to: Nobody/Anonymous (nobody)
Summary: KeyError in multiprocessing environment
Initial Comment:
When disabling the cache, SQLObject works quiet well in a multiprocessing environment.
Sometimes SQLObject throws KeyError from the sqlobject.cache.CacheSet.put method in the following line:
self.caches[cls.__name__].put(id, obj)
This seems to be because of a mapped object is put back to the DB without getting it from the DB in the same process.
----------------------------------------------------------------------
>Comment By: LJSilver (ljsilver)
Date: 2012-05-11 06:35
Message:
I've managed to fix it using the following monkey patch:
def sqlobject_cache_put_monkey(self, id, cls, obj):
try:
self.caches[cls.__name__].put(id, obj)
except KeyError:
self.caches[cls.__name__] =
sqlobject.cache.CacheFactory(*self.args, **self.kw)
self.caches[cls.__name__].put(id, obj)
sqlobject.cache.CacheSet.put = sqlobject_cache_put_monkey
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=3525829&group_id=74338
|