web.pyのsession.DiskStore concurrency問題
web.pyのsession.DiskStore concurrency問題の対策
A possible solution is to update session.DiskStore.setitem to become:
def __setitem__(self, key, value):
path = self._get_path(key)
pickled = self.encode(value)
try:
tname = path+"."+threading.current_thread().getName()
f = open(tname, 'w')
try:
f.write(pickled)
finally:
f.close()
os.rename(tname, path) # atomary operation
except IOError:
pass
by HansWeltar
https://github.com/webpy/webpy/issues/191
コメントを残す
メールアドレスは公開されません。