-
Notifications
You must be signed in to change notification settings - Fork 28
Cache issues related to entity_type , entity and notifications #1607
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
base: tenant_phase2_temp
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -289,11 +289,12 @@ module.exports = class EntityHelper { | |
| } | ||
|
|
||
| // Clear cache for affected models before deletion | ||
| await this._clearUserCachesForEntityTypeChange(organizationCode, tenantCode, { | ||
| id: entityToDelete.id, | ||
| value: entityToDelete.value, | ||
| modelNames: entityToDelete.model_names, | ||
| }) | ||
| await this._clearUserCachesForEntityTypeChange( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we calling _clearUserCachesForEntityTypeChange twice(line 343)? |
||
| organizationCode, | ||
| tenantCode, | ||
| entityToDelete.model_names ? entityToDelete.model_names[0] : null, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we using just the first element from the array? What happens if there are two models for the same entity type? |
||
| entityToDelete.value | ||
| ) | ||
|
|
||
| // SECOND: Delete from database | ||
| const deleteCount = await entityTypeQueries.deleteOneEntityType(id, organizationCode, tenantCode) | ||
|
|
@@ -544,13 +545,13 @@ module.exports = class EntityHelper { | |
| }) | ||
| ) | ||
|
|
||
| // 2. Clear entity type caches for unified model strategy | ||
| // 2. Clear entity type cache for the specific model + value | ||
| if (modelName) { | ||
| clearPromises.push( | ||
| cacheHelper.entityTypes | ||
| .delete(tenantCode, organizationCode, `model:${modelName}:__ALL__`) | ||
| .delete(tenantCode, organizationCode, modelName, entityValue) | ||
|
sumanvpacewisdom marked this conversation as resolved.
|
||
| .catch((error) => { | ||
| /* Failed to clear unified entity type cache - continue operation */ | ||
| /* Failed to clear entity type cache - continue operation */ | ||
| }) | ||
| ) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getMentorKafka(src/generics/cacheHelper.js:1036) still has the same.get()parameter mismatch.It calls
this.get(tenantCode, organizationCode, userIds), butmentor.get(line 884) only accepts(tenantCode, mentorId). The fallback at line 1105 has the same issue. The PR fixed this for session and mentee, but not here. No impact for now since it’s not used.Also, in
getMenteeKafka(src/generics/cacheHelper.js:1332–1333),userIsMentorMapis referenced but never defined. This throws aReferenceError(caught at line 1337), causing errors to be logged every time DB users are found, skipping the success log at 1335, and also shadowinguserMentorEntriesfrom line 1311.