Skip to content

[Tech Debt] Implement periodic cleanup for token refresh locks #408

@cbcoutinho

Description

@cbcoutinho

Context

From PR #401 code review - Medium priority follow-up item.

Problem

Token broker's _user_refresh_locks dictionary (line 132) accumulates locks but never cleans up unused ones, leading to potential memory leak over time.

Proposed Solution

Implement periodic cleanup of locks that haven't been used recently. Consider:

  • Track last access time per lock
  • Background task to clean locks older than threshold (e.g., 1 hour)
  • Configurable cleanup interval

References

Priority

Medium - Does not affect correctness, but impacts long-running deployments

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions