Browse Source

Removed maxAllowedScheduledUpdateIntervalInSecForCF from tenantProfileConfiguration

pull/13920/head
dshvaika 1 year ago
parent
commit
bf83848076
  1. 2
      common/data/src/main/java/org/thingsboard/server/common/data/tenant/profile/DefaultTenantProfileConfiguration.java
  2. 8
      dao/src/main/java/org/thingsboard/server/dao/cf/BaseCalculatedFieldService.java

2
common/data/src/main/java/org/thingsboard/server/common/data/tenant/profile/DefaultTenantProfileConfiguration.java

@ -174,8 +174,6 @@ public class DefaultTenantProfileConfiguration implements TenantProfileConfigura
private long maxArgumentsPerCF = 10;
@Schema(example = "3600")
private int minAllowedScheduledUpdateIntervalInSecForCF = 3600;
@Schema(example = "86400")
private int maxAllowedScheduledUpdateIntervalInSecForCF = 86400;
@Builder.Default
@Min(value = 1, message = "must be at least 1")
@Schema(example = "1000")

8
dao/src/main/java/org/thingsboard/server/dao/cf/BaseCalculatedFieldService.java

@ -97,10 +97,10 @@ public class BaseCalculatedFieldService extends AbstractEntityService implements
if (!configuration.isScheduledUpdateEnabled()) {
return;
}
var defaultProfileConfiguration = tbTenantProfileCache.get(calculatedField.getTenantId()).getDefaultProfileConfiguration();
int min = defaultProfileConfiguration.getMinAllowedScheduledUpdateIntervalInSecForCF();
int max = defaultProfileConfiguration.getMaxAllowedScheduledUpdateIntervalInSecForCF();
configuration.setScheduledUpdateIntervalSec(Math.max(min, Math.min(configuration.getScheduledUpdateIntervalSec(), max)));
int tenantProfileMinAllowedValue = tbTenantProfileCache.get(calculatedField.getTenantId())
.getDefaultProfileConfiguration()
.getMinAllowedScheduledUpdateIntervalInSecForCF();
configuration.setScheduledUpdateIntervalSec(Math.max(configuration.getScheduledUpdateIntervalSec(), tenantProfileMinAllowedValue));
}
@Override

Loading…
Cancel
Save