From a974dbc5bb80d9521f11147cbb51556a2aab8da4 Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 8 Nov 2022 01:37:20 +0100 Subject: [PATCH] fix: fetch data with reliable ordering --- src/worker/visualizer.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/worker/visualizer.rs b/src/worker/visualizer.rs index b556f69..85ec2ac 100644 --- a/src/worker/visualizer.rs +++ b/src/worker/visualizer.rs @@ -124,6 +124,7 @@ impl AppState { // TODO parallelize all this stuff self.panels = entities::panels::Entity::find() .order_by(entities::panels::Column::Position, Order::Asc) + .order_by(entities::panels::Column::Id, Order::Asc) .all(db).await?; if let Err(e) = self.tx.panels.send(self.panels.clone()) { error!(target: "state-manager", "Could not send panels update: {:?}", e); @@ -131,6 +132,7 @@ impl AppState { self.sources = entities::sources::Entity::find() .order_by(entities::sources::Column::Position, Order::Asc) + .order_by(entities::sources::Column::Id, Order::Asc) .all(db).await?; if let Err(e) = self.tx.sources.send(self.sources.clone()) { error!(target: "state-manager", "Could not send sources update: {:?}", e); @@ -138,6 +140,8 @@ impl AppState { self.metrics = entities::metrics::Entity::find() .order_by(entities::metrics::Column::Position, Order::Asc) + .order_by(entities::metrics::Column::SourceId, Order::Asc) + .order_by(entities::metrics::Column::Id, Order::Asc) .all(db).await?; if let Err(e) = self.tx.metrics.send(self.metrics.clone()) { error!(target: "state-manager", "Could not send metrics update: {:?}", e);