Commit 2b9759a9 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 27c1870a
...@@ -159,20 +159,10 @@ class ZSync: ...@@ -159,20 +159,10 @@ class ZSync:
# zconn = DB.open(transaction_manager=tm) # zconn = DB.open(transaction_manager=tm)
# tm.commit() # zconn.at updated (zconn.afterCompletion -> zconn.newTransaction) # tm.commit() # zconn.at updated (zconn.afterCompletion -> zconn.newTransaction)
# tm.commit() # zconn.at updated again # tm.commit() # zconn.at updated again
#
# TODO test for that.
#zconn.onOpenCallback(zsync)
zconn.onResyncCallback(zsync) zconn.onResyncCallback(zsync)
""" # DB resyncs .zconn onto new database view.
# DB.open() pops .zconn from connection pool and "opens" for usage. # -> resync .wconn to updated database view of ZODB connection.
# -> resync .wconn to new database view of ZODB connection.
#
def on_connection_open(zsync):
print('ZSync.resync %r %r' % (zsync.zconn, zsync.wconn))
zsync.wconn.resync(zconn_at(zsync.zconn))
"""
def on_connection_resync(zsync): def on_connection_resync(zsync):
#print('\nZZZSync.resync %r %r' % (zsync.zconn, zsync.wconn)) #print('\nZZZSync.resync %r %r' % (zsync.zconn, zsync.wconn))
#import traceback; traceback.print_stack() #import traceback; traceback.print_stack()
......
...@@ -341,6 +341,10 @@ def test_zodb_onresync(): ...@@ -341,6 +341,10 @@ def test_zodb_onresync():
assert t.nresync == 2 assert t.nresync == 2
transaction.commit() transaction.commit()
assert t.nresync == 3 assert t.nresync == 3
transaction.commit()
assert t.nresync == 4
transaction.commit()
assert t.nresync == 5
conn.close() conn.close()
......
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