diff --git a/CHANGELOG.md b/CHANGELOG.md index a59e0cf6..93f1f18b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/VERSION b/VERSION index 96506fd2..e314328a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v3.0.2 +v3.0.3 diff --git a/drivers/dao/tables/adc_count.go b/drivers/dao/tables/adc_count.go index df2c0b94..c021b79e 100644 --- a/drivers/dao/tables/adc_count.go +++ b/drivers/dao/tables/adc_count.go @@ -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"` diff --git a/drivers/explorer/impl.go b/drivers/explorer/impl.go index 7eef6b95..5bedf56a 100644 --- a/drivers/explorer/impl.go +++ b/drivers/explorer/impl.go @@ -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() @@ -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) @@ -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) diff --git a/drivers/explorer/types.go b/drivers/explorer/types.go index be19c70a..71ac2f05 100644 --- a/drivers/explorer/types.go +++ b/drivers/explorer/types.go @@ -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" diff --git a/frontend/src/.env b/frontend/src/.env index d106c803..04b5e6d9 100644 --- a/frontend/src/.env +++ b/frontend/src/.env @@ -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 diff --git a/frontend/src/src/views/Home/handleSetCharts.tsx b/frontend/src/src/views/Home/handleSetCharts.tsx index 7eba6ad5..fd067a2e 100644 --- a/frontend/src/src/views/Home/handleSetCharts.tsx +++ b/frontend/src/src/views/Home/handleSetCharts.tsx @@ -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; @@ -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; });