Skip to content

Commit

Permalink
Fix the issue that fallback data is not used
Browse files Browse the repository at this point in the history
  • Loading branch information
bclswl0827 committed Aug 8, 2024
1 parent ac50096 commit a60171a
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

Starting from v2.2.5, all notable changes to this project will be documented in this file.

## v3.0.3

### Bug Fixes

- Fixed an issue on the frontend where the CPU and memory usage percentages were not displayed correctly.
- Resolved a backend issue where the timestamp, latitude, longitude, and elevation values were always 0 when fallback values were expected.

## v3.0.2

### New Features
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.0.2
v3.0.3
2 changes: 1 addition & 1 deletion drivers/dao/tables/adc_count.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

type AdcCount struct {
dao.BaseModel
Timestamp int64 `gorm:"column:timestamp;not null;index"`
Timestamp int64 `gorm:"column:timestamp;index;not null;unique"`
Z_Axis array.Int32Array `gorm:"column:z_axis;type:text"`
E_Axis array.Int32Array `gorm:"column:e_axis;type:text"`
N_Axis array.Int32Array `gorm:"column:n_axis;type:text"`
Expand Down
5 changes: 3 additions & 2 deletions drivers/explorer/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ func (e *ExplorerDriverImpl) handleReadLegacyPacket(deps *ExplorerDependency) {
return
case <-ticker.C:
if len(dataBuffer) > 0 {
deps.Health.Received++
deps.Health.UpdatedAt = time.Now()
deps.Health.Received++

// Fix jitter in the timestamp
t, _ := deps.FallbackTime.GetTime()
Expand Down Expand Up @@ -308,7 +308,7 @@ func (e *ExplorerDriverImpl) handleReadMainlinePacket(deps *ExplorerDependency)
deps.Health.Errors++
continue
}
if deps.Config.Latitude != 0 && deps.Config.Longitude != 0 && deps.Config.Elevation != 0 {
if e.mainlinePacketHeader.latitude != 0 && e.mainlinePacketHeader.longitude != 0 && e.mainlinePacketHeader.elevation != 0 {
deps.Config.Latitude = float64(e.mainlinePacketHeader.latitude)
deps.Config.Longitude = float64(e.mainlinePacketHeader.longitude)
deps.Config.Elevation = float64(e.mainlinePacketHeader.elevation)
Expand Down Expand Up @@ -360,6 +360,7 @@ func (e *ExplorerDriverImpl) handleReadMainlinePacket(deps *ExplorerDependency)
if time.Duration(math.Abs(float64(t.Sub(prevTime).Milliseconds()))) <= EXPLORER_GENERAL_JITTER {
t = deps.FallbackTime.Fix(t, prevTime, time.Second)
}
finalPacket.Timestamp = t.UnixMilli()
prevTime = t
}
deps.messageBus.Publish("explorer", &finalPacket)
Expand Down
2 changes: 1 addition & 1 deletion drivers/explorer/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
messagebus "github.com/vardius/message-bus"
)

const EXPLORER_GENERAL_JITTER = 2 * time.Millisecond
const EXPLORER_GENERAL_JITTER = 10 * time.Millisecond

const (
EXPLORER_CHANNEL_CODE_Z = "Z"
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
REACT_APP_VERSION=v3.0.2
REACT_APP_RELEASE=732d9df6-20240808110748
REACT_APP_VERSION=v3.0.3
REACT_APP_RELEASE=ac50096d-20240808200400
8 changes: 8 additions & 0 deletions frontend/src/src/views/Home/handleSetCharts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export const handleSetCharts = (
timestamp - initTimestamp >= RETENTION_THRESHOLD_MS
);
}
prev.cpu.holder.values = {
...prev.cpu.holder.values,
usage: cpuPercent.toFixed(2)
};

// Set memory usage chart
const { percent: memoryPercent } = res.data.memory;
Expand All @@ -54,6 +58,10 @@ export const handleSetCharts = (
timestamp - initTimestamp >= RETENTION_THRESHOLD_MS
);
}
prev.memory.holder.values = {
...prev.memory.holder.values,
usage: memoryPercent.toFixed(2)
};

return prev;
});
Expand Down

0 comments on commit a60171a

Please sign in to comment.