diff --git a/application/src/main/resources/thingsboard.yml b/application/src/main/resources/thingsboard.yml index cbc4e79dd3..024eb54974 100644 --- a/application/src/main/resources/thingsboard.yml +++ b/application/src/main/resources/thingsboard.yml @@ -1643,7 +1643,7 @@ queue: # DELETE_LATEST_TS, DELETE_TS_HISTORY, DELETE_EVENTS, DELETE_ALARMS, UNASSIGN_ALARMS disabled-task-types: "${TB_HOUSEKEEPER_DISABLED_TASK_TYPES:}" # Delay in milliseconds between tasks reprocessing - task-reprocessing-delay-ms: "${TB_HOUSEKEEPER_TASK_REPROCESSING_DELAY_MS:5000}" + task-reprocessing-delay-ms: "${TB_HOUSEKEEPER_TASK_REPROCESSING_DELAY_MS:3000}" # Maximum amount of task reprocessing attempts. After exceeding, the task will be dropped max-reprocessing-attempts: "${TB_HOUSEKEEPER_MAX_REPROCESSING_ATTEMPTS:10}" stats: diff --git a/common/queue/src/main/java/org/thingsboard/server/queue/housekeeper/HousekeeperConfig.java b/common/queue/src/main/java/org/thingsboard/server/queue/housekeeper/HousekeeperConfig.java index b03861a7ee..4ca3776d4d 100644 --- a/common/queue/src/main/java/org/thingsboard/server/queue/housekeeper/HousekeeperConfig.java +++ b/common/queue/src/main/java/org/thingsboard/server/queue/housekeeper/HousekeeperConfig.java @@ -32,7 +32,7 @@ public class HousekeeperConfig { private int taskProcessingTimeout; @Value("${queue.core.housekeeper.poll-interval-ms:500}") private int pollInterval; - @Value("${queue.core.housekeeper.task-reprocessing-delay-ms:5000}") + @Value("${queue.core.housekeeper.task-reprocessing-delay-ms:3000}") private int taskReprocessingDelay; @Value("${queue.core.housekeeper.max-reprocessing-attempts:10}") private int maxReprocessingAttempts; diff --git a/dao/src/main/java/org/thingsboard/server/dao/entity/EntityDaoRegistry.java b/dao/src/main/java/org/thingsboard/server/dao/entity/EntityDaoRegistry.java index 10e301cce6..7b2f2d42c1 100644 --- a/dao/src/main/java/org/thingsboard/server/dao/entity/EntityDaoRegistry.java +++ b/dao/src/main/java/org/thingsboard/server/dao/entity/EntityDaoRegistry.java @@ -20,19 +20,23 @@ import org.springframework.stereotype.Service; import org.thingsboard.server.common.data.EntityType; import org.thingsboard.server.dao.Dao; +import java.util.EnumMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; @Service @Slf4j public class EntityDaoRegistry { - private final Map> daos; + private final Map> daos = new EnumMap<>(EntityType.class); private EntityDaoRegistry(List> daos) { - this.daos = daos.stream().filter(dao -> dao.getEntityType() != null) - .collect(Collectors.toMap(Dao::getEntityType, dao -> dao)); + daos.forEach(dao -> { + EntityType entityType = dao.getEntityType(); + if (entityType != null) { + this.daos.put(entityType, dao); + } + }); } @SuppressWarnings("unchecked")