Skip to content

CLARIN-DSpace v9: SSR idle timer only in the browser, drain xhr2 redirect bodies - #1642

Open
milanmajchrak wants to merge 2 commits into
dtq-dev-93from
9-base/fe-ssr-idle-timer-redirect-drain
Open

milanmajchrak wants to merge 2 commits into
dtq-dev-93from
9-base/fe-ssr-idle-timer-redirect-drain

Conversation

@milanmajchrak

@milanmajchrak milanmajchrak commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

References

Ports this customer/TUL PR:

The same fix for dtq-dev is #1636 (open).

Description

On the server, two things kept every finished SSR render in memory: the idle timer of AuthEffects and the socket of a REST redirect that xhr2 followed without reading the body. The timer now runs only in the browser, and redirect bodies are drained.

Instructions for Reviewers

List of changes in this PR:

  • AuthEffects.trackIdleness$: the first filter lets actions through only in the browser. PLATFORM_ID is injected in the constructor.
  • ServerXhrService: wraps xhr2's _onHttpResponse and calls response.resume() on 301, 302, 303, 307 and 308.
  • auth.effects.spec.ts: in the browser the user is still set idle after timeUntilIdle. On the server no timer starts. That spec runs with fakeAsync(..., { flush: false }), so a pending timer fails it.
  • ServerXhrService has no spec. Karma uses the browser build of xhr2.

How to test:

  • npm run test -- --include=src/app/core/auth/auth.effects.spec.ts: 27 specs pass. With the browser filter disabled, the server spec fails with 1 periodic timer(s) still in the queue.
  • After a deploy, send a burst of /handle/... requests (each one triggers the pid/find 302 on the REST side). The heap of the SSR process goes back down afterwards instead of growing until a restart.

Codex review (gpt-6.2-sol, high), 2 rounds: 1 finding fixed (the server spec did not fail on a pending timer), the last round found nothing. Not changed: a Node test for the redirect drain, because the repo has no Node test runner for server code.

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.

🤖 Generated with Claude Code

…rect bodies

Port of TUL PR 1597 (commit 6a74ddb), written for the 9.x code.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@milanmajchrak
milanmajchrak changed the base branch from dtq-dev-9-base to dtq-dev-93 November 17, 2026 15:57
The spec ticked past the deadline, so a timer started on the server would go unnoticed. fakeAsync with flush: false now fails on it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

1 participant