Skip to content

Commit

Permalink
DINC0367584 :Issue with repository Id caching in multitenacy SDM CAP-JS
Browse files Browse the repository at this point in the history
Now its cached based on subdomain and repositoryId combination
  • Loading branch information
rashmiangadi11 committed Jan 13, 2025
1 parent 5182681 commit 0b192e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/sdm.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ module.exports = class SDMAttachmentsService extends (

async checkRepositoryType(req) {
const { repositoryId } = getConfigurations();
let subdomain = cds.context.user?.tokenInfo?.getPayload()?.ext_attr?.zdn;
//check if repository is versionable
let repotype = cache.get(repositoryId)
let repotype = cache.get(repositoryId+"_"+subdomain);
let isVersioned;
if (repotype == undefined) {
const token = await getClientCredentialsToken(this.creds);
Expand Down
5 changes: 3 additions & 2 deletions lib/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ function isRepositoryVersioned(repoInfo, repositoryId) {
}

function saveRepoToCache(repositoryId, type) {
const repoType = cache.get(repositoryId);
let subdomain = cds.context.user?.tokenInfo?.getPayload()?.ext_attr?.zdn;
const repoType = cache.get(repositoryId+"_"+subdomain);
if (repoType === undefined) {
cache.set(repositoryId, type, 60 * 60 * 24 * 60);
cache.set((repositoryId+"_"+subdomain), type, 60 * 60 * 24 * 60);
}
}

Expand Down

0 comments on commit 0b192e9

Please sign in to comment.