Correct first target state filename

This commit is contained in:
lash 2022-03-19 01:13:37 +00:00
parent 43249a9ec0
commit 2b5383e9e0
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 17 additions and 2 deletions

View File

@ -236,9 +236,9 @@ class SyncFsStore:
self.item_keys.append(block_number)
logg.info('added existing {}'.format(o))
fp = os.path.join(self.session_path, str(target))
fp = os.path.join(self.session_path, 'target')
if len(thresholds) == 0:
logg.info('syncer first run')
logg.info('syncer first run target {}'.format(target))
self.first = True
f = open(fp, 'w')
f.write(str(target))

View File

@ -203,5 +203,20 @@ class TestFs(unittest.TestCase):
o = store.get(2)
def test_sync_history_interrupted(self):
store = SyncFsStore(self.path, session_id='foo')
session = SyncSession(store)
session.start(target=13)
o = session.get(0)
o.next(advance_block=True)
o.next(advance_block=True)
session.stop(o)
store = SyncFsStore(self.path, session_id='foo')
store.start()
o = store.get(0)
if __name__ == '__main__':
unittest.main()