Skip to content

Server check guard change 7 x #4100

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

Draft
wants to merge 3 commits into
base: dspace-7_x
Choose a base branch
from

Conversation

YanaDePauw
Copy link
Contributor

References

Fixes #4074

Description

After getting rid of the of /server/api request for #3961, one more /server/api check was found in the ServerCheckGuard that will be performed with every load to check if the server is not down.

This can still affect performance when a slower REST API is used.

This PR removes the initial call on load to check if the backend is up. Instead it will only perform this call if a request fails with a 500 or a 0 (Unknown) status. If the server request then fails, a redirect is done to the 500 page.

The additional check and redirect are performed in the request effects but will not hold up the rest of the object handling.

Instructions for Reviewers

To test this feature, set up a local backend and frontend where you can turn the backend on and off.

  1. In Angular, test on the initial load that no extra check is performed to the api endpoint to verify that it is running.
  2. Verify that the repository still runs as it normally does.
  3. Turn off the backend and verify that on the next (non-cached) request you are redirected to a 500 page.
  4. Turn the backend on again and click the "return to homepage" button.
  5. Verify that you are redirected to the homepage and you can browse the repository again.
  6. Turn the backend off again and hard refresh the page
  7. Verify that you are redirected to the 500 page again.

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.

@alanorth alanorth changed the base branch from main to dspace-7_x March 19, 2025 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance: unnecessary ServerCheckGuard api call
1 participant