Skip to content
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

Prevent unnecessary RBAC users request #567

Merged
merged 1 commit into from Sep 8, 2021

Conversation

gwenneg
Copy link
Member

@gwenneg gwenneg commented Sep 8, 2021

No description provided.

Comment on lines +123 to +124
quarkus.cache.caffeine.rbac-recipient-users-provider-get-users.expire-after-write=PT10M
quarkus.cache.caffeine.rbac-recipient-users-provider-get-group-users.expire-after-write=PT10M
Copy link
Member Author

Choose a reason for hiding this comment

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

As suggested by @pilhuhn on Slack yesterday.

Prod is currently caching data for 1 minute (the 5 minute increase hasn't been deployed).

@gwenneg gwenneg marked this pull request as draft September 8, 2021 07:16
@@ -119,7 +119,7 @@ public void initCounters() {
AtomicInteger::new,
state -> fetcher.apply(state.getAndIncrement())
)
.until(page -> page.getData().isEmpty())
.whilst(page -> page.getData().size() == rbacElementsPerPage)
Copy link
Member Author

Choose a reason for hiding this comment

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

Most of the time, this will prevent one RBAC request per recipients resolution.

See this for details about until and whilst.

Copy link
Member Author

Choose a reason for hiding this comment

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

There's an error in the Javadoc BTW: until stops when the predicates passes (the Javadoc says the opposite).

Copy link
Contributor

Choose a reason for hiding this comment

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

From reading the Javadoc, whilst() is really what we want.

Copy link
Member Author

Choose a reason for hiding this comment

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

@gwenneg gwenneg marked this pull request as ready for review September 8, 2021 07:40
Copy link
Contributor

@pilhuhn pilhuhn left a comment

Choose a reason for hiding this comment

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

lgtm

@gwenneg gwenneg merged commit 7953ed1 into RedHatInsights:master Sep 8, 2021
@gwenneg gwenneg deleted the rbac-optimization branch September 8, 2021 07: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
2 participants