Detect done sync in store start function
This commit is contained in:
parent
9758ade3d5
commit
f4c6936517
@ -241,17 +241,26 @@ class SyncFsStore:
|
|||||||
logg.info('added existing {}'.format(o))
|
logg.info('added existing {}'.format(o))
|
||||||
|
|
||||||
fp = os.path.join(self.session_path, 'target')
|
fp = os.path.join(self.session_path, 'target')
|
||||||
if len(thresholds) == 0:
|
have_target = False
|
||||||
logg.info('syncer first run target {}'.format(target))
|
try:
|
||||||
self.first = True
|
f = open(fp, 'r')
|
||||||
f = open(fp, 'w')
|
v = f.read()
|
||||||
f.write(str(target))
|
|
||||||
f.close()
|
f.close()
|
||||||
|
self.target = int(v)
|
||||||
|
have_target = True
|
||||||
|
except FileNotFoundError as e:
|
||||||
|
pass
|
||||||
|
|
||||||
f = open(fp, 'r')
|
if len(thresholds) == 0:
|
||||||
v = f.read()
|
if have_target:
|
||||||
f.close()
|
logg.warning('sync "{}" is already done, nothing to do'.format(self.session_id))
|
||||||
self.target = int(v)
|
else:
|
||||||
|
logg.info('syncer first run target {}'.format(target))
|
||||||
|
self.first = True
|
||||||
|
f = open(fp, 'w')
|
||||||
|
f.write(str(target))
|
||||||
|
f.close()
|
||||||
|
self.target = target
|
||||||
|
|
||||||
|
|
||||||
def start(self, offset=0, target=-1):
|
def start(self, offset=0, target=-1):
|
||||||
|
Loading…
Reference in New Issue
Block a user