Browse Source

Merge pull request #16643 from RomenKost/fix/system-patch-after-startup-lts-4.4

Run system patch migrations after application startup
pull/16653/head
Viacheslav Klimov 3 weeks ago
committed by GitHub
parent
commit
c19c6012cb
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      application/src/main/java/org/thingsboard/server/service/system/SystemPatchApplier.java
  2. 1
      common/queue/src/main/java/org/thingsboard/server/queue/util/AfterStartUp.java

6
application/src/main/java/org/thingsboard/server/service/system/SystemPatchApplier.java

@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.hash.Hashing; import com.google.common.hash.Hashing;
import com.google.common.io.Resources; import com.google.common.io.Resources;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
@ -20,6 +19,7 @@ import org.thingsboard.server.common.data.widget.WidgetsBundle;
import org.thingsboard.server.dao.resource.ImageService; import org.thingsboard.server.dao.resource.ImageService;
import org.thingsboard.server.dao.widget.WidgetTypeService; import org.thingsboard.server.dao.widget.WidgetTypeService;
import org.thingsboard.server.dao.widget.WidgetsBundleService; import org.thingsboard.server.dao.widget.WidgetsBundleService;
import org.thingsboard.server.queue.util.AfterStartUp;
import org.thingsboard.server.queue.util.TbCoreComponent; import org.thingsboard.server.queue.util.TbCoreComponent;
import org.thingsboard.server.service.install.DatabaseSchemaSettingsService; import org.thingsboard.server.service.install.DatabaseSchemaSettingsService;
import org.thingsboard.server.service.install.InstallScripts; import org.thingsboard.server.service.install.InstallScripts;
@ -66,8 +66,8 @@ public class SystemPatchApplier {
private final ImageService imageService; private final ImageService imageService;
private final MigrationService migrationService; private final MigrationService migrationService;
@PostConstruct @AfterStartUp(order = AfterStartUp.SYSTEM_PATCH)
private void init() { public void init() {
ExecutorService executor = Executors.newSingleThreadExecutor(ThingsBoardThreadFactory.forName("system-patch-applier")); ExecutorService executor = Executors.newSingleThreadExecutor(ThingsBoardThreadFactory.forName("system-patch-applier"));
executor.submit(() -> { executor.submit(() -> {
try { try {

1
common/queue/src/main/java/org/thingsboard/server/queue/util/AfterStartUp.java

@ -18,6 +18,7 @@ import java.lang.annotation.Target;
@Order @Order
public @interface AfterStartUp { public @interface AfterStartUp {
int SYSTEM_PATCH = 0;
int QUEUE_INFO_INITIALIZATION = 1; int QUEUE_INFO_INITIALIZATION = 1;
int DISCOVERY_SERVICE = 2; int DISCOVERY_SERVICE = 2;

Loading…
Cancel
Save