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