Skip to content

feat: Add resilient, non-blocking realm registration for Token Status plugin#70

Merged
Awambeng merged 6 commits into
mainfrom
fix-realm-registration
Apr 13, 2026
Merged

feat: Add resilient, non-blocking realm registration for Token Status plugin#70
Awambeng merged 6 commits into
mainfrom
fix-realm-registration

Conversation

@Awambeng

@Awambeng Awambeng commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator

This PR improves the reliability and performance of realm registration in the Keycloak Token Status Plugin by making it asynchronous, non-blocking, and more fault-tolerant.

Key Improvements

Non-blocking registration

  • Startup and lazy registration now run in background threads
  • Prevents Keycloak boot delays and OIDC request timeouts

Self-healing behavior

  • Automatically triggers registration on the first OIDC request if not yet completed
  • Adds a 60s cooldown per realm to avoid repeated failures when the server returns errors

Improved network resilience

  • Retry mechanism with exponential backoff (1s, 2s, 4s, …)
  • Increased timeout to 30s for slow responses

Stability fixes

  • Fixed NPE during master realm initialization
  • Added thread-safe per-realm locking for concurrent requests

For more details see: https://adorsys.atlassian.net/wiki/x/2IoXl

Closes #69

@forkimenjeckayang forkimenjeckayang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A few concerns to check @Awambeng
Also for CustomHttpClient.java StatusListConfig.java

The new defaults (retry=1, timeout=30s) are reasonable for startup robustness, but this client is reused in runtime request paths too. Can we split startup vs runtime HTTP policies (or make retry configurable) to avoid increasing tail latency for user-facing flows?
WDYT?

@IngridPuppet IngridPuppet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I left some comments. Please could you check?

Comment thread README.md Outdated
@Awambeng Awambeng force-pushed the fix-realm-registration branch from 4fd276f to 2c5075d Compare April 2, 2026 15:49
Awambeng added 5 commits April 2, 2026 16:59
… cooldown, and increase default HTTP client retry count and issuance timeout for enhanced robustness

Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
…ies table

Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
@Awambeng Awambeng force-pushed the fix-realm-registration branch from 2c5075d to b0ee497 Compare April 2, 2026 16:00
…plicitly pass retry counts

Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
@Awambeng Awambeng requested a review from IngridPuppet April 2, 2026 16:04

@IngridPuppet IngridPuppet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@forkimenjeckayang forkimenjeckayang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No further concerns

@Awambeng Awambeng merged commit 63f480f into main Apr 13, 2026
1 check passed
@Awambeng Awambeng deleted the fix-realm-registration branch April 13, 2026 09:01
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.

Implement Robust and Resilient Realm Registration

3 participants