Skip to content

Commit edc076d

Browse files
committed
Make scheduledInterval for discovery 0 if mode is WRITE_ONLY
1 parent 4d30fd1 commit edc076d

File tree

2 files changed

+8
-5
lines changed
  • components/apimgt
    • org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model
    • org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao

2 files changed

+8
-5
lines changed

components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/model/Environment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class Environment implements Serializable {
5353
private String description;
5454
private boolean isReadOnly;
5555
private String mode = GatewayMode.WRITE_ONLY.getMode();
56-
private int apiDiscoveryScheduledWindow = 60;
56+
private int apiDiscoveryScheduledWindow = 0;
5757
private List<VHost> vhosts = new ArrayList<>();
5858
private String provider;
5959
private String gatewayType;

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15682,7 +15682,7 @@ public List<Environment> getAllEnvironments(String tenantDomain) throws APIManag
1568215682
}
1568315683
int scheduledTime = rs.getInt("SCHEDULED_TIME");
1568415684
if (rs.wasNull()) {
15685-
scheduledTime = 60;
15685+
scheduledTime = 0;
1568615686
}
1568715687
Map<String, String> additionalProperties = new HashMap();
1568815688
try (InputStream configuration = rs.getBinaryStream("CONFIGURATION")) {
@@ -15746,7 +15746,7 @@ public Environment getEnvironment(String tenantDomain, String uuid) throws APIMa
1574615746
}
1574715747
int scheduledTime = rs.getInt("SCHEDULED_TIME");
1574815748
if (rs.wasNull()) {
15749-
scheduledTime = 60;
15749+
scheduledTime = 0;
1575015750
}
1575115751
Map<String, String> additionalProperties = new HashMap();
1575215752
try (InputStream configuration = rs.getBinaryStream("CONFIGURATION")) {
@@ -15807,8 +15807,11 @@ public Environment addEnvironment(String tenantDomain, Environment environment)
1580715807
String configurationJson = new Gson().toJson(environment.getAdditionalProperties());
1580815808
prepStmt.setBinaryStream(8, new ByteArrayInputStream(configurationJson.getBytes()));
1580915809
prepStmt.setString(9, tenantDomain);
15810-
prepStmt.setString(10, (StringUtils.isEmpty(environment.getMode()) ? GatewayMode.WRITE_ONLY.getMode() : environment.getMode()));
15811-
prepStmt.setInt(11, environment.getApiDiscoveryScheduledWindow());
15810+
prepStmt.setString(10, (StringUtils.isEmpty(environment.getMode()) ?
15811+
GatewayMode.WRITE_ONLY.getMode() :
15812+
environment.getMode()));
15813+
prepStmt.setInt(11, (StringUtils.isEmpty(environment.getMode()) || GatewayMode.WRITE_ONLY.getMode()
15814+
.equals(environment.getMode())) ? 0 : environment.getApiDiscoveryScheduledWindow());
1581215815
prepStmt.executeUpdate();
1581315816

1581415817
GatewayVisibilityPermissionConfigurationDTO permissionDTO = environment.getPermissions();

0 commit comments

Comments
 (0)