Skip to content

Commit

Permalink
Fix identity refresh bug for all roles
Browse files Browse the repository at this point in the history
This commit resolves an issue where role identities
(like `reviewed_by` or `merged_by` among others) were not
refreshed.
The bug occurred because the queries to OpenSearch filtered
items in which `author_uuid` was the individual pk, but not
when the `<role>_uuid` was the individual pk. That causes many
items that contain the `<role>_uuid` but not the `author_uuid`
not to be refreshed.

For example, the `Author` role was not affected because it
matched `author_uuid`, but roles like `reviewed_by` did not
match and were missed.

Signed-off-by: Jose Javier Merchante <[email protected]>
  • Loading branch information
jjmerchante committed Aug 8, 2024
1 parent f2a96e0 commit 12b99cf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions releases/unreleased/identity-refresh-bug-for-some-items.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Identity refresh bug for some items
category: fixed
author: Jose Javier Merchante <[email protected]>
issue: null
notes: >
Fix issue where some fields were not refreshed.
The bug occurred because the queries to OpenSearch filtered
items in which `author_uuid` was the individual pk, but not
when the `<role>_uuid` was the individual pk. That causes many
items that contain the `<role>_uuid` but not the `author_uuid`
not to be refreshed.
4 changes: 4 additions & 0 deletions sirmordred/task_enrich.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,16 @@ def __autorefresh(self, enrich_backend, studies=False):
next_autorefresh = self.__update_last_autorefresh()

logger.debug('Getting last modified identities from SH since %s for %s', after, self.backend_section)

author_fields = ["author_uuid"]
for role in enrich_backend.roles:
author_fields.append(role + '_uuid')
try:
meta_fields = enrich_backend.meta_fields
author_fields += meta_fields
except AttributeError:
pass

logger.debug("Refreshing identity ids for %s", self.backend_section)
total = 0
time_start = datetime.now()
Expand Down

0 comments on commit 12b99cf

Please sign in to comment.