Handling error in RedisListenerConfig
When we shut down the server, the redis subscription is not closed cleanly leading to the server to hang. Adding an error handler solves for this issue.
This commit is contained in:
parent
d178b1c729
commit
314cdd29d9
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
image: docker:latest
|
||||
services:
|
||||
- docker:dind
|
||||
- redis
|
||||
|
||||
cache:
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
#When you are building, name it appsmith-server which is how it is referenced in docker-compose.yml
|
||||
|
||||
#FROM openjdk:11
|
||||
FROM adoptopenjdk/openjdk11:alpine-slim
|
||||
|
||||
LABEL maintainer="tech@appsmith.com"
|
||||
|
||||
VOLUME /tmp
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ARG JAR_FILE=appsmith-server/target/server-1.0-SNAPSHOT.jar
|
||||
|
||||
#Add the jar to the container. Always keep this at the end. This is to ensure that all the things that can be taken
|
||||
#care of via the cache happens. The following statement would lead to copy because of change in hash value
|
||||
ADD ${JAR_FILE} server.jar
|
||||
|
||||
#Run the jar
|
||||
ENTRYPOINT ["java", "-Dspring.profiles.active=docker", "-jar", "/server.jar"]
|
||||
|
|
@ -54,6 +54,11 @@ public class RedisListenerConfig {
|
|||
})
|
||||
// Actual processing of the message.
|
||||
.map(redisPluginObj -> pluginService.redisInstallPlugin((InstallPluginRedisDTO) redisPluginObj))
|
||||
// Handle this error because it prevents the Redis connection from shutting down when the server is shut down
|
||||
// TODO: Verify if this is invoked in normal redis pubsub execution as well
|
||||
.doOnError(throwable -> {
|
||||
log.error("Error occurred in the RedisListenerConfig: ", throwable);
|
||||
})
|
||||
// Required to subscribe else this chain is never invoked
|
||||
.subscribe();
|
||||
return container;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user