Skip to content

Fixed search page still returning stale data after invalidating a request #3888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

alexandrevryghem
Copy link
Member

@alexandrevryghem alexandrevryghem commented Jan 23, 2025

Description

Fixed problem with the SearchService methods that could return stale data. This was fixed in the same way as BaseDataService was applied here to prevent outdated data from being emitted.

Instructions for Reviewers

List of changes in this PR:

  • Added a skipWhile method to both the search & getFacetValuesFor to skip stale data and to ignore non stale data when useCachedVersionIfAvailable is true
  • Cleaned up the SearchService test class

Guidance for how to test or review your PR:

Checklist

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using npm run lint
  • My PR doesn't introduce circular dependencies (verified via npm run check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • My PR aligns with Accessibility guidelines if it makes changes to the user interface.
  • My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

…ad of waiting for non-stale response

This was problematic for the places that used getFist operators. This is because they only emit data once, and the first value could be the old cached value
@alexandrevryghem alexandrevryghem added bug component: Discovery related to discovery search or browse system performance / caching Related to performance, caching or embedded objects port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release labels Jan 23, 2025
@alexandrevryghem alexandrevryghem added this to the 9.0 milestone Jan 23, 2025
@alexandrevryghem alexandrevryghem self-assigned this Jan 23, 2025
@ybnd ybnd self-requested a review January 24, 2025 10:11
@ybnd
Copy link
Member

ybnd commented Jan 24, 2025

Checked this out real quick, but it looks like this doesn't immediately help with #3869.
I'll make some time for a proper review soon 👍

Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks @alexandrevryghem . I tested this alongside DSpace/DSpace#10030 and #3892 . While I ran into small bugs with the other two PRs, I don't believe those were caused by this PR. I couldn't find any issues with this PR, as it appears to ensure the search results are returning properly.

That said, I'm going to wait to merge this until we get the bugs fixed in #3892 (especially), just to ensure there's no side effects being caused here.

That should also give @ybnd a chance to review this, if he has time. (per the above comment)

@tdonohue
Copy link
Member

tdonohue commented Feb 3, 2025

@alexandrevryghem and @ybnd : I was reminded about this PR today. Is this important to get into 8.1 / 7.6.3 (which are likely to come out this week)? I was waiting to merge this until @ybnd or someone else had a chance to give it another look.

The door on 8.1 / 7.6.3 is closing quickly, and I'm not likely to merge much of anything else, unless it's a significant fix.

I'm not able to reproduce "stale data" behavior (or haven't found a way to do so with this PR standalone), but I was able to verified this PR doesn't appear to cause side effects.

@alexandrevryghem
Copy link
Member Author

alexandrevryghem commented Feb 4, 2025

@tdonohue: No one noticed this bug until now so for us it's fine to not merge this until DSpace/DSpace#10030 is merged, even if that's means that this PR will be delayed until 8.3 / 7.6.4

Copy link

Hi @alexandrevryghem,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Retested again today now that DSpace/DSpace#10030 is merged. Still looks good. Thanks again @alexandrevryghem

@tdonohue tdonohue merged commit 67e91e3 into DSpace:main Apr 29, 2025
15 checks passed
@github-project-automation github-project-automation bot moved this from 👍 Reviewer Approved to ✅ Done in DSpace 9.0 Release Apr 29, 2025
@dspace-bot
Copy link
Contributor

@dspace-bot
Copy link
Contributor

Backport failed for dspace-8_x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin dspace-8_x
git worktree add -d .worktree/backport-3888-to-dspace-8_x origin/dspace-8_x
cd .worktree/backport-3888-to-dspace-8_x
git switch --create backport-3888-to-dspace-8_x
git cherry-pick -x edfaee6aab58bcb3b1f3d122d3b70276b0c0d8fa 58ff240c0525ce71c73046382f66cff458c970ad

@tdonohue
Copy link
Member

@alexandrevryghem : Could you manually backport this to 8.x? It looks like it ported automatically to 7.6.x, but the 8.x port failed.

@tdonohue tdonohue removed the port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release label Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component: Discovery related to discovery search or browse system performance / caching Related to performance, caching or embedded objects port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

4 participants