mirror of
https://git.alemi.dev/dashboard.git
synced 2024-11-22 15:34:54 +01:00
fix: excessive logging and records overlapping
This commit is contained in:
parent
08ed95d74c
commit
ddf237861c
2 changed files with 3 additions and 9 deletions
|
@ -46,7 +46,6 @@ pub async fn surveyor_loop(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info!(target: "surveyor", "Reloaded sources and metrics");
|
|
||||||
last_fetch = Utc::now().timestamp();
|
last_fetch = Utc::now().timestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -252,8 +252,7 @@ impl AppState {
|
||||||
if let Err(e) = self.tx.points.send(self.points.clone().into()) {
|
if let Err(e) = self.tx.points.send(self.points.clone().into()) {
|
||||||
warn!(target: "state-manager", "Could not send new points: {:?}", e); // TODO should be an err?
|
warn!(target: "state-manager", "Could not send new points: {:?}", e); // TODO should be an err?
|
||||||
}
|
}
|
||||||
self.last_check = Utc::now().timestamp() - *self.width.borrow();
|
self.last_check = now;
|
||||||
info!(target: "state-manager", "Reloaded points");
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,19 +263,15 @@ impl AppState {
|
||||||
|
|
||||||
// fetch previous points
|
// fetch previous points
|
||||||
if new_width != self.last_width {
|
if new_width != self.last_width {
|
||||||
let mut previous_points = entities::points::Entity::find()
|
let previous_points = entities::points::Entity::find()
|
||||||
.filter(
|
.filter(
|
||||||
Condition::all()
|
Condition::all()
|
||||||
.add(entities::points::Column::X.gte(now - new_width))
|
.add(entities::points::Column::X.gte(now - new_width))
|
||||||
.add(entities::points::Column::X.lte(now - self.last_width))
|
.add(entities::points::Column::X.lte(now - self.last_width))
|
||||||
)
|
)
|
||||||
.order_by(entities::points::Column::X, Order::Asc)
|
.order_by(entities::points::Column::X, Order::Desc)
|
||||||
.all(db)
|
.all(db)
|
||||||
.await?;
|
.await?;
|
||||||
if previous_points.len() > 0 {
|
|
||||||
info!(target: "state-manager", "Fetched {} previous points", previous_points.len());
|
|
||||||
}
|
|
||||||
previous_points.reverse(); // TODO wasteful!
|
|
||||||
for p in previous_points {
|
for p in previous_points {
|
||||||
self.points.push_front(p);
|
self.points.push_front(p);
|
||||||
changes = true;
|
changes = true;
|
||||||
|
|
Loading…
Reference in a new issue