Minor improvements

This commit is contained in:
Andrii Shvaika 2025-02-11 12:47:37 +02:00
parent 5efb94dc7a
commit d75bc3ac28
2 changed files with 2 additions and 4 deletions

View File

@ -47,7 +47,7 @@ import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@ConditionalOnProperty(prefix = "zk", value = "enabled", havingValue = "false", matchIfMissing = true)
@ConditionalOnProperty(prefix = "zk", value = "enabled", havingValue = "false", matchIfMissing = true) // Queue type in mem or Kafka;
public class RocksDBCalculatedFieldStateService implements CalculatedFieldStateService {
private final ActorSystemContext actorSystemContext;
@ -66,12 +66,11 @@ public class RocksDBCalculatedFieldStateService implements CalculatedFieldStateS
restoreStates().forEach((k, v) -> actorSystemContext.tell(new CalculatedFieldStateRestoreMsg(k, v)));
}
@Override
public void persistState(CalculatedFieldCtx ctx, CalculatedFieldEntityCtxId stateId, CalculatedFieldState state, TbCallback callback) {
CalculatedFieldStateProto stateProto = toProto(stateId, state);
long maxStateSizeInKBytes = ctx.getMaxStateSizeInKBytes();
if (maxStateSizeInKBytes <= 0 || stateProto.getSerializedSize() <= ctx.getMaxStateSizeInKBytes()) {
if (maxStateSizeInKBytes <= 0 || stateProto.getSerializedSize() <= maxStateSizeInKBytes) {
rocksDBService.put(toProto(stateId), stateProto);
}
callback.onSuccess();

View File

@ -41,7 +41,6 @@ public @interface AfterStartUp {
int CF_READ_PROFILE_ENTITIES_SERVICE = 10;
int CF_READ_CF_SERVICE = 11;
int CF_STATE_RESTORE_SERVICE = 12;
int CF_CONSUMER_SERVICE = 13;
int BEFORE_TRANSPORT_SERVICE = Integer.MAX_VALUE - 1001;
int TRANSPORT_SERVICE = Integer.MAX_VALUE - 1000;