Fix rule engine startup

This commit is contained in:
ViacheslavKlimov 2025-05-14 09:49:27 +03:00
parent 4fbb6c2e71
commit 55da7ac2b6
2 changed files with 4 additions and 3 deletions

View File

@ -95,7 +95,7 @@ public abstract class EdqsSyncService {
syncLatestTimeseries(); syncLatestTimeseries();
counters.clear(); counters.clear();
log.info("Finishing synchronizing data to EDQS in {} ms", (System.currentTimeMillis() - startTs)); log.info("Finished synchronizing data to EDQS in {} ms", (System.currentTimeMillis() - startTs));
} }
private void process(TenantId tenantId, ObjectType type, EdqsObject object) { private void process(TenantId tenantId, ObjectType type, EdqsObject object) {

View File

@ -62,6 +62,7 @@ import org.thingsboard.server.dao.tenant.TenantService;
import org.thingsboard.server.queue.TbQueueCallback; import org.thingsboard.server.queue.TbQueueCallback;
import org.thingsboard.server.service.job.JobManager; import org.thingsboard.server.service.job.JobManager;
import java.util.Optional;
import java.util.Set; import java.util.Set;
@Slf4j @Slf4j
@ -72,7 +73,7 @@ public class EntityStateSourcingListener {
private final TenantService tenantService; private final TenantService tenantService;
private final TbClusterService tbClusterService; private final TbClusterService tbClusterService;
private final EdgeSynchronizationManager edgeSynchronizationManager; private final EdgeSynchronizationManager edgeSynchronizationManager;
private final JobManager jobManager; private final Optional<JobManager> jobManager;
@PostConstruct @PostConstruct
public void init() { public void init() {
@ -303,7 +304,7 @@ public class EntityStateSourcingListener {
} }
private void onJobUpdate(Job job) { private void onJobUpdate(Job job) {
jobManager.onJobUpdate(job); jobManager.ifPresent(jobManager -> jobManager.onJobUpdate(job));
if (job.getResult().getCancellationTs() > 0 || (job.getStatus().isOneOf(JobStatus.FAILED) && job.getResult().getGeneralError() != null)) { if (job.getResult().getCancellationTs() > 0 || (job.getStatus().isOneOf(JobStatus.FAILED) && job.getResult().getGeneralError() != null)) {
// task processors will add this job to the list of discarded // task processors will add this job to the list of discarded
tbClusterService.broadcastEntityStateChangeEvent(job.getTenantId(), job.getId(), ComponentLifecycleEvent.STOPPED); tbClusterService.broadcastEntityStateChangeEvent(job.getTenantId(), job.getId(), ComponentLifecycleEvent.STOPPED);