Commit b798fe8e authored by Julien Muchembled's avatar Julien Muchembled

client: enable patch to avoid useless ping to master at end of transactions

parent c277ed20
......@@ -90,20 +90,20 @@ if 1:
Connection_open = Connection.open
Connection.open = open
# Storage.sync usually implements a "network barrier" (at least
# in NEO, but ZEO should be fixed to do the same), which is quite
# slow so we prefer to not call it where it's not useful.
# I don't know any legitimate use of DB access outside a transaction.
# But old versions of ERP5 (before 2010-10-29 17:15:34) and maybe other
# applications do not always call 'transaction.begin()' when they should
# so this patch disabled as a precaution, at least as long as we support
# old software. This should also be discussed on zodb-dev ML first.
# IStorage implementations usually need to provide a "network barrier",
# at least for NEO & ZEO, to make sure we have an up-to-date view of
# the storage. It's unclear whether sync() is a good place to do this
# because a round-trip to the server introduces latency and we prefer
# it's not done when it's not useful.
# For example, we know we are up-to-date after a successful commit,
# so this should not be done in afterCompletion(), and anyway, we don't
# know any legitimate use of DB access outside a transaction.
def afterCompletion(self, *ignored):
try:
self._readCurrent.clear()
except AttributeError: # BBB: ZODB < 3.10
pass
# PATCH: do not call sync()
self._flush_invalidations()
#Connection.afterCompletion = afterCompletion
Connection.afterCompletion = afterCompletion
......@@ -653,12 +653,7 @@ class NEOCluster(object):
def stop(self):
if hasattr(self, '_db') and self.client.em._timeout == 0:
self.client.setPoll(True)
sync = Storage.Storage.sync.im_func
Storage.Storage.sync = lambda self, force=True: None
try:
self.__dict__.pop('_db', self.client).close()
finally:
Storage.Storage.sync = sync
try:
Serialized.release(stop=
self.admin_list + self.storage_list + self.master_list)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment