Fix BaseRepository invalidateCacheById

When we cache user documents by ID, we use a key based on an object like { filter: { _id: "ObjectId" } }

Then, during the login request, we attempt to invalidate the cached user by calling BaseRepository.invalidateCacheById, which internally triggers invalidateCacheByFilterId asynchronously.


As a result, in some cases, the next request in the test scenario might be executed before invalidateCacheByFilterId has completed. This leads to the user being retrieved from the cache instead of the database, causing the Unauthorized issue reported by many CI/CD executions โ€” specifically, the cached user does not contain the token returned during login.

Domain
AuthN-Z
Action
hotfix
Department
Backend

Please authenticate to join the conversation.

Upvoters
Status

Completed

Board
๐Ÿ› ๏ธ

Bug & Fixes

Date

10 months ago

Author

Ivan Ligotino

Subscribe to post

Get notified by email when there are changes.