Skip to content

Commit

Permalink
Add synchronized block for redeploy logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Arshardh committed Oct 31, 2023
1 parent 2df6a99 commit 4b9597d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,13 @@ public boolean deployAllAPIs(Set<String> assignedGatewayLabels, String tenantDom

boolean result = false;
Map<String, org.wso2.carbon.apimgt.keymgt.model.entity.API> apiMap = null;
try {
deployJWKSSynapseAPI(tenantDomain); // Deploy JWKS API
} catch (APIManagementException e) {
log.error("Error while deploying JWKS API for tenant domain :" + tenantDomain, e);

if (!redeployChangedAPIs) {
try {
deployJWKSSynapseAPI(tenantDomain); // Deploy JWKS API
} catch (APIManagementException e) {
log.error("Error while deploying JWKS API for tenant domain :" + tenantDomain, e);
}
}
if (gatewayArtifactSynchronizerProperties.isRetrieveFromStorageEnabled()) {
if (artifactRetriever != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,10 @@ public void onReconnect() {
if (refreshOnReconnect) {
log.info("Refreshing gateway data stores and deployments.");
new Thread(() -> {
SubscriptionDataHolder.getInstance().refreshSubscriptionStore();
redeployGatewayArtifacts();
synchronized (this) {
SubscriptionDataHolder.getInstance().refreshSubscriptionStore();
redeployGatewayArtifacts();
}
}).start();
}
}
Expand Down

0 comments on commit 4b9597d

Please sign in to comment.