mirror of
https://git.alemi.dev/dashboard.git
synced 2024-11-22 07:24:52 +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;
|
||||
}
|
||||
}
|
||||
info!(target: "surveyor", "Reloaded sources and metrics");
|
||||
last_fetch = Utc::now().timestamp();
|
||||
}
|
||||
|
||||
|
|
|
@ -252,8 +252,7 @@ impl AppState {
|
|||
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?
|
||||
}
|
||||
self.last_check = Utc::now().timestamp() - *self.width.borrow();
|
||||
info!(target: "state-manager", "Reloaded points");
|
||||
self.last_check = now;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -264,19 +263,15 @@ impl AppState {
|
|||
|
||||
// fetch previous points
|
||||
if new_width != self.last_width {
|
||||
let mut previous_points = entities::points::Entity::find()
|
||||
let previous_points = entities::points::Entity::find()
|
||||
.filter(
|
||||
Condition::all()
|
||||
.add(entities::points::Column::X.gte(now - new_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)
|
||||
.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 {
|
||||
self.points.push_front(p);
|
||||
changes = true;
|
||||
|
|
Loading…
Reference in a new issue