chainsyncer

Blockchain syncer driver
Log | Files | Refs | LICENSE

commit ea73d0082ec37d3278c1bfd7135f83cc96b5b9e6
parent 9bd61f71bbd150271cde48bb2cb1f84eb9eb5b97
Author: nolash <dev@holbrook.no>
Date:   Tue, 23 Feb 2021 08:46:14 +0100

Remove redundant postgres connections in backend resume method

Diffstat:
Mchainsyncer/backend.py | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/chainsyncer/backend.py b/chainsyncer/backend.py @@ -199,11 +199,16 @@ class SyncerBackend: o = q.get(object_id) (highest_unsynced_block, highest_unsynced_index) = o.cursor() - for object_id in BlockchainSync.get_unsynced(session=session): + object_ids = BlockchainSync.get_unsynced(session=session) + session.close() + + for object_id in object_ids: logg.debug('block syncer resume added previously unsynced sync entry id {}'.format(object_id)) s = SyncerBackend(chain_spec, object_id) syncers.append(s) + session = SessionBase.create_session() + last_live_id = BlockchainSync.get_last(session=session) if last_live_id != None: