Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions invenio_cern_sync/groups/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def sync(**kwargs):
log_uuid=log_uuid,
)
roles_ids = create_or_update_roles(_serialize_groups(groups))
# db.session.commit() happens inside create_or_update_roles
log_info(
log_name,
dict(
Expand Down
5 changes: 2 additions & 3 deletions invenio_cern_sync/users/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,9 @@ def _update_existing(users, serializer_fn, log_uuid, log_name):
), f"User and UserIdentity are not correctly linked for user #{user.id} and user_identity #{user_identity.id}"

if update_existing_user(user, user_identity, invenio_user):
db.session.commit()
updated.add(user.id)

# persist changes before starting with the inserting of missing users
db.session.commit()
log_info(
log_name,
dict(action=log_action, status="completed", updated_count=len(updated)),
Expand Down Expand Up @@ -195,9 +194,9 @@ def _insert_missing(invenio_users, log_uuid, log_name):
f"Error creating user from CERN data: {e}. Skipping this user... User: {invenio_user}"
)
continue
db.session.commit()
inserted.add(_id)

db.session.commit()
log_info(
log_name,
dict(action=log_action, status="completed", inserted_count=len(inserted)),
Expand Down