[ server ] [ execution ]- execution log persistence accomplish -1

This commit is contained in:
zeaslity
2023-01-13 18:19:30 +08:00
parent 73b2bf0078
commit 9332ca5533

View File

@@ -2,6 +2,7 @@ package io.wdd.rpc.execute.result;
import io.wdd.rpc.execute.config.CommandReaderConfig; import io.wdd.rpc.execute.config.CommandReaderConfig;
import io.wdd.server.utils.SpringUtils; import io.wdd.server.utils.SpringUtils;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.connection.stream.ReadOffset; import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset; import org.springframework.data.redis.connection.stream.StreamOffset;
@@ -10,6 +11,7 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import static io.wdd.rpc.execute.result.RedisStreamReaderConfig.EXECUTION_RESULT_REDIS_STREAM_LISTENER_CONTAINER; import static io.wdd.rpc.execute.result.RedisStreamReaderConfig.EXECUTION_RESULT_REDIS_STREAM_LISTENER_CONTAINER;
@@ -36,10 +38,13 @@ public class BuildStreamReader {
} }
@SneakyThrows
private void modifyExecutionStreamReader(CommandReaderConfig commandReaderConfig) { private void modifyExecutionStreamReader(CommandReaderConfig commandReaderConfig) {
// stop the old stream listener container // stop the old stream listener container
this.streamMessageListenerContainer.stop(); if (this.streamMessageListenerContainer.isRunning()) {
this.streamMessageListenerContainer.stop();
}
// modify container // modify container
this.streamMessageListenerContainer.receive( this.streamMessageListenerContainer.receive(
@@ -52,7 +57,9 @@ public class BuildStreamReader {
) )
); );
// very important // very important
TimeUnit.MILLISECONDS.sleep(500);
this.streamMessageListenerContainer.start(); this.streamMessageListenerContainer.start();
} }