Skip to content

Commit

Permalink
fixing subscription issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tharindu1st committed Feb 18, 2024
1 parent a05a87d commit d943cc9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions common-controller/internal/utils/event_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ func sendApplicationKeyMappingEvent(applicationUUID string, applicationSpec cpv1
ApplicationIdentifier: env.AppID,
KeyType: env.KeyType,
EnvID: env.EnvID,
Organization: applicationSpec.Organization,
},
}
sendEvent(&event)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,11 @@ public void addApplicationMapping(org.wso2.apk.enforcer.discovery.subscription.A
resolvedApplicationMapping.setUuid(applicationMapping.getUuid());
resolvedApplicationMapping.setApplicationUUID(applicationMapping.getApplicationRef());
resolvedApplicationMapping.setSubscriptionUUID(applicationMapping.getSubscriptionRef());
if (applicationMappingMap.containsKey(resolvedApplicationMapping.getUuid())) {
applicationMappingMap.replace(resolvedApplicationMapping.getUuid(), resolvedApplicationMapping);
resolvedApplicationMapping.setOrganization(applicationMapping.getOrganization());
if (applicationMappingMap.containsKey(resolvedApplicationMapping.getCacheKey())) {
applicationMappingMap.replace(resolvedApplicationMapping.getCacheKey(), resolvedApplicationMapping);
} else {
applicationMappingMap.put(resolvedApplicationMapping.getUuid(), resolvedApplicationMapping);
applicationMappingMap.put(resolvedApplicationMapping.getCacheKey(), resolvedApplicationMapping);
}
}

Expand Down Expand Up @@ -342,7 +343,8 @@ public void removeApplicationMapping(org.wso2.apk.enforcer.discovery.subscriptio
resolvedApplicationMapping.setUuid(applicationMapping.getUuid());
resolvedApplicationMapping.setApplicationUUID(applicationMapping.getApplicationRef());
resolvedApplicationMapping.setSubscriptionUUID(applicationMapping.getSubscriptionRef());
applicationMappingMap.remove(resolvedApplicationMapping.getUuid());
resolvedApplicationMapping.setOrganization(applicationMapping.getOrganization());
applicationMappingMap.remove(resolvedApplicationMapping.getCacheKey());
}

@Override
Expand Down

0 comments on commit d943cc9

Please sign in to comment.