WIP implement sync done in resume sync for mock driver
This commit is contained in:
parent
ecb123f495
commit
7078adaf7e
@ -110,7 +110,6 @@ class SyncDriver:
|
|||||||
if self.block_callback != None:
|
if self.block_callback != None:
|
||||||
self.block_callback(block, None)
|
self.block_callback(block, None)
|
||||||
|
|
||||||
last_block = block
|
|
||||||
try:
|
try:
|
||||||
self.process(conn, item, block, tx_start)
|
self.process(conn, item, block, tx_start)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
@ -120,6 +119,9 @@ class SyncDriver:
|
|||||||
if self.post_callback != None:
|
if self.post_callback != None:
|
||||||
self.post_callback()
|
self.post_callback()
|
||||||
|
|
||||||
|
if self.store.target > -1 and block.number >= self.store.target:
|
||||||
|
self.running = False
|
||||||
|
|
||||||
self.idle(interval)
|
self.idle(interval)
|
||||||
|
|
||||||
|
|
||||||
|
@ -195,7 +195,10 @@ class MockDriver(SyncDriver):
|
|||||||
|
|
||||||
|
|
||||||
def get(self, conn, item):
|
def get(self, conn, item):
|
||||||
return self.blocks[item.cursor]
|
try:
|
||||||
|
return self.blocks[item.cursor]
|
||||||
|
except KeyError:
|
||||||
|
raise NoBlockForYou()
|
||||||
|
|
||||||
|
|
||||||
def process(self, conn, item, block, tx_start):
|
def process(self, conn, item, block, tx_start):
|
||||||
|
@ -128,7 +128,9 @@ class TestFilter(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
store = SyncFsStore(self.path, state_event_callback=state_event_handler, filter_state_event_callback=filter_state_event_handler)
|
store = SyncFsStore(self.path, state_event_callback=state_event_handler, filter_state_event_callback=filter_state_event_handler)
|
||||||
drv = MockDriver(store)
|
fltr_one = MockFilter('foo')
|
||||||
|
store.register(fltr_one)
|
||||||
|
drv = MockDriver(store, target=1)
|
||||||
generator.apply(drv, offset=1)
|
generator.apply(drv, offset=1)
|
||||||
drv.run(self.conn, interval=0.1)
|
drv.run(self.conn, interval=0.1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user