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

Query Keycloak for user deletions every 5 minutes #4615

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

eleftherias
Copy link
Contributor

Summary

Change the interval that we use to poll Keycloak for deletion events, from 1 hour to 5 minutes.
This way, if a user deletes their account elsewhere, they can re-create their account on Minder after at most 5 minutes.

Fixes #4614

Change Type

Mark the type of change your PR introduces:

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

Outline how the changes were tested, including steps to reproduce and any relevant configurations.
Attach screenshots if helpful.

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

@@ -76,7 +76,7 @@ func HandleEvents(
cfg *serverconfig.Config,
projectDeleter projects.ProjectDeleter,
) {
d := time.Now().Add(time.Duration(10) * time.Minute)
d := time.Now().Add(time.Duration(5) * time.Minute)
Copy link
Contributor

@blkt blkt Oct 2, 2024

Choose a reason for hiding this comment

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

question (non-blocking): just a clarification: this is unrelated, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is unrelated to the interval, but I figured if we're querying every 5 minutes, then we want to cancel any old event processing if it's taken longer than 5 minutes, to avoid attempting the same deletions twice.

Copy link
Member

Choose a reason for hiding this comment

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

There was another timeout on line 149; I'll send a PR for it.

@coveralls
Copy link

Coverage Status

coverage: 53.109% (+0.004%) from 53.105%
when pulling f00399d on eleftherias:4614-delete-user-interval
into 6514ae4 on stacklok:main.

@eleftherias eleftherias merged commit 15fd53d into mindersec:main Oct 2, 2024
21 checks passed
@eleftherias eleftherias deleted the 4614-delete-user-interval branch October 2, 2024 14:57
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.

Change polling interval to be 5mins instead of 1h
4 participants