Skip to content

Commit

Permalink
Fix response time measurements for VesselDetail and VesselPath
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasGLund99 committed Dec 12, 2024
1 parent 2cd5aec commit 3b03ae9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/vesselDetailsBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default function VesselDetailsBox() {
const fetchDetails = async () => {
if (!selectedVesselmmsi) return

console.time('VesselDetails')
try {
const details = await clientHandler.getVesselInfo({
mmsi: selectedVesselmmsi,
Expand All @@ -34,18 +35,18 @@ export default function VesselDetailsBox() {
} catch (e) {
console.error(e)
}
console.timeEnd('VesselDetails')
}

console.time('VesselDetails')
fetchDetails()
console.timeEnd('VesselDetails')
setLoading(false)
}, [clientHandler, myDateTimeRef, selectedVesselmmsi])

// Fetch path history on path duration change and show path
useEffect(() => {
async function tryGetVesselPath() {
if (!selectedVesselmmsi) return
console.time('VesselPath')
try {
const res = await clientHandler.getVesselPath({
mmsi: selectedVesselmmsi,
Expand All @@ -56,14 +57,13 @@ export default function VesselDetailsBox() {
} catch (e) {
console.error(e)
}
console.timeEnd('VesselPath')
}

if (!pathIsShown) {
setSelectedVesselPath([])
} else {
console.time('VesselPath')
tryGetVesselPath()
console.timeEnd('VesselPath')
}
}, [clientHandler, myDateTimeRef, pathDuration, pathIsShown, selectedVesselmmsi, setSelectedVesselPath])

Expand Down

0 comments on commit 3b03ae9

Please sign in to comment.