Merge pull request #12282 from jekka001/fix/edge-hp-events

Fix widget type sync up
This commit is contained in:
Viacheslav Klimov 2024-12-18 12:20:46 +02:00 committed by GitHub
commit d87d1d553d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -135,7 +135,7 @@ public abstract class EdgeGrpcSession implements Closeable {
private StreamObserver<RequestMsg> inputStream; private StreamObserver<RequestMsg> inputStream;
private StreamObserver<ResponseMsg> outputStream; private StreamObserver<ResponseMsg> outputStream;
private boolean connected; private volatile boolean connected;
private volatile boolean syncCompleted; private volatile boolean syncCompleted;
private EdgeVersion edgeVersion; private EdgeVersion edgeVersion;
@ -536,13 +536,15 @@ public abstract class EdgeGrpcSession implements Closeable {
public void processHighPriorityEvents() { public void processHighPriorityEvents() {
try { try {
List<EdgeEvent> highPriorityEvents = new ArrayList<>(); if (isConnected() && isSyncCompleted()) {
EdgeEvent event; List<EdgeEvent> highPriorityEvents = new ArrayList<>();
while ((event = highPriorityQueue.poll()) != null) { EdgeEvent event;
highPriorityEvents.add(event); while ((event = highPriorityQueue.poll()) != null) {
highPriorityEvents.add(event);
}
List<DownlinkMsg> downlinkMsgsPack = convertToDownlinkMsgsPack(highPriorityEvents);
sendDownlinkMsgsPack(downlinkMsgsPack).get();
} }
List<DownlinkMsg> downlinkMsgsPack = convertToDownlinkMsgsPack(highPriorityEvents);
sendDownlinkMsgsPack(downlinkMsgsPack).get();
} catch (Exception e) { } catch (Exception e) {
log.error("[{}] Failed to process high priority events", sessionId, e); log.error("[{}] Failed to process high priority events", sessionId, e);
} }