Browse Source

updated UI to display another default value for wsMessageQueuePerSession (1000 instead of 0)

pull/8241/head
dashevchenko 4 years ago
parent
commit
b42d663670
  1. 6
      application/src/main/data/upgrade/3.4.4/schema_update.sql
  2. 4
      application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java
  3. 1
      application/src/main/resources/thingsboard.yml
  4. 6
      dao/src/main/java/org/thingsboard/server/dao/service/validator/TenantProfileDataValidator.java
  5. 3
      ui-ngx/src/app/modules/home/components/profile/tenant/default-tenant-profile-configuration.component.html
  6. 1
      ui-ngx/src/assets/locale/locale.constant-en_US.json

6
application/src/main/data/upgrade/3.4.4/schema_update.sql

@ -348,9 +348,3 @@ $$;
-- ALARM FUNCTIONS END
-- TENANT PROFILE START
update tenant_profile SET profile_data = jsonb_set(profile_data, array['configuration','wsMsgQueueLimitPerSession'], to_jsonb(1000))
WHERE profile_data::json#>>'{configuration,wsMsgQueueLimitPerSession}' = '0';
-- TENANT PROFILE END

4
application/src/main/java/org/thingsboard/server/controller/plugin/TbWebSocketHandler.java

@ -81,6 +81,8 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr
private long sendTimeout;
@Value("${server.ws.ping_timeout:30000}")
private long pingTimeout;
@Value("${server.ws.max_queue_messages_per_session:1000}")
private int wsQueueMessagesPerSession;
private final ConcurrentMap<String, TelemetryWebSocketSessionRef> blacklistedSessions = new ConcurrentHashMap<>();
private final ConcurrentMap<String, TbRateLimits> perSessionUpdateLimits = new ConcurrentHashMap<>();
@ -142,7 +144,7 @@ public class TbWebSocketHandler extends TextWebSocketHandler implements Telemetr
var tenantProfileConfiguration = getTenantProfileConfiguration(sessionRef);
internalSessionMap.put(internalSessionId, new SessionMetaData(session, sessionRef,
tenantProfileConfiguration != null && tenantProfileConfiguration.getWsMsgQueueLimitPerSession() > 0 ?
tenantProfileConfiguration.getWsMsgQueueLimitPerSession() : 500));
tenantProfileConfiguration.getWsMsgQueueLimitPerSession() : wsQueueMessagesPerSession));
externalSessionMap.put(externalSessionId, internalSessionId);
processInWebSocketService(sessionRef, SessionEvent.onEstablished());

1
application/src/main/resources/thingsboard.yml

@ -65,6 +65,7 @@ server:
max_per_user: "${TB_SERVER_WS_DYNAMIC_PAGE_LINK_MAX_PER_USER:10}"
max_entities_per_data_subscription: "${TB_SERVER_WS_MAX_ENTITIES_PER_DATA_SUBSCRIPTION:10000}"
max_entities_per_alarm_subscription: "${TB_SERVER_WS_MAX_ENTITIES_PER_ALARM_SUBSCRIPTION:10000}"
max_queue_messages_per_session: "${TB_SERVER_WS_MAX_QUEUE_MESSAGES_PER_SESSION:1000}"
rest:
server_side_rpc:
# Minimum value of the server side RPC timeout. May override value provided in the REST API call.

6
dao/src/main/java/org/thingsboard/server/dao/service/validator/TenantProfileDataValidator.java

@ -58,12 +58,6 @@ public class TenantProfileDataValidator extends DataValidator<TenantProfile> {
if (tenantProfile.getProfileData().getConfiguration() == null) {
throw new DataValidationException("Tenant profile data configuration should be specified!");
}
if (tenantProfile.getProfileData().getConfiguration() instanceof DefaultTenantProfileConfiguration) {
DefaultTenantProfileConfiguration configuration = (DefaultTenantProfileConfiguration) tenantProfile.getProfileData().getConfiguration();
if (configuration.getWsMsgQueueLimitPerSession() == 0) {
throw new DataValidationException("WS message queue limit per session should be greater than 0");
}
}
if (tenantProfile.isDefault()) {
TenantProfile defaultTenantProfile = tenantProfileService.findDefaultTenantProfile(tenantId);
if (defaultTenantProfile != null && !defaultTenantProfile.getId().equals(tenantProfile.getId())) {

3
ui-ngx/src/app/modules/home/components/profile/tenant/default-tenant-profile-configuration.component.html

@ -410,6 +410,9 @@
<mat-error *ngIf="defaultTenantProfileConfigurationFormGroup.get('wsMsgQueueLimitPerSession').hasError('min')">
{{ 'tenant-profile.too-small-value-one' | translate}}
</mat-error>
<mat-hint>
{{ 'tenant-profile.value-will-be-dropped-to-default' | translate}}
</mat-hint>
</mat-form-field>
<div fxFlex></div>
</div>

1
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -3322,6 +3322,7 @@
"incorrect-pattern-for-rate-limits": "The format is comma separated pairs of capacity and period (in seconds) with a colon between, e.g. 100:1,2000:60",
"too-small-value-zero": "The value must be bigger than 0",
"too-small-value-one": "The value must be bigger than 1",
"value-will-be-dropped-to-default": "0 value will be dropped to default",
"cassandra-tenant-limits-configuration": "Cassandra query for tenant",
"ws-limit-max-sessions-per-tenant": "Sessions per tenant maximum number",
"ws-limit-max-sessions-per-customer": "Sessions per customer maximum number",

Loading…
Cancel
Save