Review comments
This commit is contained in:
parent
8b30d1d93b
commit
759bc94d1d
@ -644,7 +644,7 @@ public class ActorSystemContext {
|
|||||||
@Getter
|
@Getter
|
||||||
private String deviceStateNodeRateLimitConfig;
|
private String deviceStateNodeRateLimitConfig;
|
||||||
|
|
||||||
@Value("${actors.calculated_fields.calculation_result_timeout:5}")
|
@Value("${actors.calculated_fields.calculation_timeout:5}")
|
||||||
@Getter
|
@Getter
|
||||||
private long cfCalculationResultTimeout;
|
private long cfCalculationResultTimeout;
|
||||||
|
|
||||||
|
|||||||
@ -274,13 +274,13 @@ public class CalculatedFieldEntityMessageProcessor extends AbstractContextAwareM
|
|||||||
|
|
||||||
private void processStateIfReady(CalculatedFieldCtx ctx, List<CalculatedFieldId> cfIdList, CalculatedFieldState state, UUID tbMsgId, TbMsgType tbMsgType, TbCallback callback) throws CalculatedFieldException {
|
private void processStateIfReady(CalculatedFieldCtx ctx, List<CalculatedFieldId> cfIdList, CalculatedFieldState state, UUID tbMsgId, TbMsgType tbMsgType, TbCallback callback) throws CalculatedFieldException {
|
||||||
CalculatedFieldEntityCtxId ctxId = new CalculatedFieldEntityCtxId(tenantId, ctx.getCfId(), entityId);
|
CalculatedFieldEntityCtxId ctxId = new CalculatedFieldEntityCtxId(tenantId, ctx.getCfId(), entityId);
|
||||||
boolean stateSizeOk;
|
boolean stateSizeChecked = false;
|
||||||
try {
|
try {
|
||||||
if (ctx.isInitialized() && state.isReady()) {
|
if (ctx.isInitialized() && state.isReady()) {
|
||||||
CalculatedFieldResult calculationResult = state.performCalculation(ctx).get(systemContext.getCfCalculationResultTimeout(), TimeUnit.SECONDS);
|
CalculatedFieldResult calculationResult = state.performCalculation(ctx).get(systemContext.getCfCalculationResultTimeout(), TimeUnit.SECONDS);
|
||||||
state.checkStateSize(ctxId, ctx.getMaxStateSize());
|
state.checkStateSize(ctxId, ctx.getMaxStateSize());
|
||||||
stateSizeOk = state.isSizeOk();
|
stateSizeChecked = true;
|
||||||
if (stateSizeOk) {
|
if (state.isSizeOk()) {
|
||||||
cfService.pushMsgToRuleEngine(tenantId, entityId, calculationResult, cfIdList, callback);
|
cfService.pushMsgToRuleEngine(tenantId, entityId, calculationResult, cfIdList, callback);
|
||||||
if (DebugModeUtil.isDebugAllAvailable(ctx.getCalculatedField())) {
|
if (DebugModeUtil.isDebugAllAvailable(ctx.getCalculatedField())) {
|
||||||
systemContext.persistCalculatedFieldDebugEvent(tenantId, ctx.getCfId(), entityId, state.getArguments(), tbMsgId, tbMsgType, JacksonUtil.writeValueAsString(calculationResult.getResult()), null);
|
systemContext.persistCalculatedFieldDebugEvent(tenantId, ctx.getCfId(), entityId, state.getArguments(), tbMsgId, tbMsgType, JacksonUtil.writeValueAsString(calculationResult.getResult()), null);
|
||||||
@ -290,9 +290,10 @@ public class CalculatedFieldEntityMessageProcessor extends AbstractContextAwareM
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw CalculatedFieldException.builder().ctx(ctx).eventEntity(entityId).msgId(tbMsgId).msgType(tbMsgType).arguments(state.getArguments()).cause(e).build();
|
throw CalculatedFieldException.builder().ctx(ctx).eventEntity(entityId).msgId(tbMsgId).msgType(tbMsgType).arguments(state.getArguments()).cause(e).build();
|
||||||
} finally {
|
} finally {
|
||||||
state.checkStateSize(ctxId, ctx.getMaxStateSize());
|
if (!stateSizeChecked) {
|
||||||
stateSizeOk = state.isSizeOk();
|
state.checkStateSize(ctxId, ctx.getMaxStateSize());
|
||||||
if (stateSizeOk) {
|
}
|
||||||
|
if (state.isSizeOk()) {
|
||||||
cfStateService.persistState(ctxId, state, callback);
|
cfStateService.persistState(ctxId, state, callback);
|
||||||
} else {
|
} else {
|
||||||
removeStateAndRaiseSizeException(ctxId, CalculatedFieldException.builder().ctx(ctx).eventEntity(entityId).errorMessage(ctx.getSizeExceedsLimitMessage()).build(), callback);
|
removeStateAndRaiseSizeException(ctxId, CalculatedFieldException.builder().ctx(ctx).eventEntity(entityId).errorMessage(ctx.getSizeExceedsLimitMessage()).build(), callback);
|
||||||
|
|||||||
@ -513,7 +513,7 @@ actors:
|
|||||||
# The value of DEBUG mode rate limit. By default, no more than 50 thousand events per hour
|
# The value of DEBUG mode rate limit. By default, no more than 50 thousand events per hour
|
||||||
configuration: "${ACTORS_CALCULATED_FIELD_DEBUG_MODE_RATE_LIMITS_PER_TENANT_CONFIGURATION:50000:3600}"
|
configuration: "${ACTORS_CALCULATED_FIELD_DEBUG_MODE_RATE_LIMITS_PER_TENANT_CONFIGURATION:50000:3600}"
|
||||||
# Time in seconds to receive calculation result.
|
# Time in seconds to receive calculation result.
|
||||||
calculation_result_timeout: "${ACTORS_CALCULATION_RESULT_TIMEOUT_SEC:5}"
|
calculation_timeout: "${ACTORS_CALCULATION_TIMEOUT_SEC:5}"
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
settings:
|
settings:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user