Skip to content
Snippets Groups Projects
Commit c8456459 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

ENH: indicate if updates are incomplete

parent c42a1bfc
No related branches found
No related tags found
2 merge requests!59FIX: if multiple updates for one entity exist, the retrieve would result in an...,!56F insert auth
Pipeline #28068 failed
......@@ -225,6 +225,17 @@ class Crawler(object):
for _, _, old, new, _ in changes:
new_cont = db.Container()
new_cont = new_cont.from_xml(new)
ids = []
tmp = []
update_incomplete = False
# remove duplicate entities
for el in new_cont:
if el.id not in ids:
ids.append(el.id)
tmp.append(el)
else:
update_incomplete = True
new_cont = tmp
if new[0].version:
valids = db.Container()
nonvalids = db.Container()
......@@ -234,6 +245,7 @@ class Crawler(object):
if ent.version == remote_ent.version:
valids.append(remote_ent)
else:
update_incomplete = True
nonvalids.append(remote_ent)
valids.update(unique=False)
logger.info("Successfully updated {} records!".format(
......@@ -258,6 +270,7 @@ class Crawler(object):
logger.info("Successfully updated {} records!".format(
len(new_cont)))
all_updates += len(new_cont)
logger.info("Some updates could not be applied. Crawler has to rerun.")
logger.info("Finished with authorized updates.")
return all_inserts, all_updates
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment