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

MAINT: added doc and return value to authorize_changes"

parent 1d4221f2
Branches
Tags
2 merge requests!59FIX: if multiple updates for one entity exist, the retrieve would result in an...,!56F insert auth
Pipeline #28059 passed
......@@ -349,12 +349,12 @@ class UpdateCache(AbstractCache):
return old_ones
def insert(self, cont, run_id, insert=False):
"""Insert a pending, unauthorized inserts
"""Insert a pending, unauthorized insert or update
Parameters
----------
cont: Container with the records to be inserted containing the desired
cont: Container with the records to be inserted or updated containing the desired
version, i.e. the state after the update.
run_id: int
......
......@@ -210,11 +210,14 @@ class Crawler(object):
"""
cache = UpdateCache()
inserts = cache.get_inserts(run_id)
all_inserts = 0
all_updates = 0
for _, _, _, new, _ in inserts:
new_cont = db.Container()
new_cont = new_cont.from_xml(new)
new_cont.insert(unique=False)
logger.info("Successfully inserted {} records!".format(len(new_cont)))
all_inserts += len(new_cont)
logger.info("Finished with authorized updates.")
changes = cache.get_updates(run_id)
......@@ -238,7 +241,9 @@ class Crawler(object):
new_cont.update(unique=False)
logger.info("Successfully updated {} records!".format(
len(new_cont)))
all_updates += len(new_cont)
logger.info("Finished with authorized updates.")
return all_inserts, all_updates
def collect_cfoods(self):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment