extra server on stten1/4/14 tbt
This commit is contained in:
parent
f3b19fd32b
commit
3fd2efcd7b
|
|
@ -58,16 +58,36 @@ class ArchiveSynchronizer(Component):
|
|||
if self.main_window is None:
|
||||
self.main_window = get_main_window()
|
||||
|
||||
|
||||
for record in list(Archive.select().where((Archive.archived != True) | (Archive.uploaded != True))): # using "is not True" breaks the query.. # list() forces the complete execution of the query unlocking the db unlike __enter__()
|
||||
if self.name != "remote_archiver_extra":
|
||||
# MAIN SERVER
|
||||
bit_pos = 0
|
||||
unsaved_records = Archive.select().where((Archive.archived == 0) |
|
||||
(Archive.archived == 2) |
|
||||
(Archive.uploaded == 0))
|
||||
else:
|
||||
# EXTRA SERVER (VERO PROJECT SPA)
|
||||
bit_pos = 1
|
||||
unsaved_records = Archive.select().where((Archive.archived == 0) |
|
||||
(Archive.archived == 1))
|
||||
for record in unsaved_records:
|
||||
if not self.simulate:
|
||||
if record.archived is not True:
|
||||
record.archived = self.remote_archive(record) is True
|
||||
s = time.time()
|
||||
save_ok = self.remote_archive(record) is True
|
||||
e = time.time()
|
||||
else:
|
||||
save_ok=True
|
||||
if record.uploaded is not True:
|
||||
record.uploaded = self.remote_store(record) is True
|
||||
else:
|
||||
self.log.info("simulated archive synchronizer cycle")
|
||||
#record.save()
|
||||
save_ok=True
|
||||
|
||||
if save_ok:
|
||||
record.archived |= (1 << bit_pos)
|
||||
self.log(f"({self.name}) id {record.id}:", "archived remotely", f"{(e - s):.3f}s")
|
||||
else:
|
||||
self.log(f"({self.name}) id {record.id}:", "failed to archive remotely", f"{(e - s):.3f}s")
|
||||
self.main_window.run_request.emit(record.save, [], {})
|
||||
|
||||
if self.hold_time > 0:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user