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

This commit is contained in:
dashevchenko 2023-03-21 12:25:42 +02:00
parent 74ce748059
commit b42d663670
6 changed files with 8 additions and 13 deletions

View File

@ -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

View File

@ -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());

View File

@ -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.

View File

@ -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())) {

View File

@ -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>

View File

@ -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",