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:
Arpit Mohan 2019-10-23 05:20:44 +00:00
parent d178b1c729
commit 314cdd29d9
3 changed files with 5 additions and 20 deletions

View File

@ -5,7 +5,6 @@
image: docker:latest
services:
- docker:dind
- redis
cache:

View File

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

View File

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