I've got an object that I'm putting to a session object that has its
own __getstate__ and __setstate__ method defined. After a restart of
webkit, the SessionDynamicStore object loads the pickled file twice,
calling my object's __setstate__ method twice.
Specifically, beginning at line 130 of SessionDynamicStore in
"MoveToMemory", the code first gets the object via the __getitem__
method (decoding via a pickle.load) and then deletes it from itself
via its own __delitem__ method -- which in turn calls __getitem__
again so it can call its .expiring method before doing an os.remove
on the actual file.
Has anyone had trouble with having an expensive __setstate__ method
for objects being put into memory? My object's __setstate__ method
essentially bootstraps itself into existence with a minimal amount of
info pickled from the __getstate__ method since the data inside my
object is not pickle-able.
Is there a way around having a pickled object being created twice by
the SessionStore? I'm looking at creating a class attribute in my
object that would keep track of whether these objects have been
bootstrapped or not.