Refined interval calculation in ApiServerProvider to adjust polling frequency based on time range, introducing new thresholds for intervals over 1, 2, and 3 days.
This commit is contained in:
parent
b7e81e2caa
commit
5f33ed69fb
@ -969,10 +969,16 @@ const ApiServerProvider = ({ children }) => {
|
||||
const timeRangeMs = endDate.getTime() - startDate.getTime()
|
||||
const oneHourMs = 60 * 60 * 1000
|
||||
const twelveHoursMs = 12 * 60 * 60 * 1000
|
||||
const oneDayMs = 24 * 60 * 60 * 1000
|
||||
const threeDaysMs = 3 * 24 * 60 * 60 * 1000
|
||||
|
||||
// Determine interval based on time range
|
||||
let intervalMinutes = 1 // Default: 1 minute
|
||||
if (timeRangeMs > twelveHoursMs) {
|
||||
if (timeRangeMs > threeDaysMs) {
|
||||
intervalMinutes = 60 // Over 1 day: 60 minutes
|
||||
} else if (timeRangeMs > oneDayMs) {
|
||||
intervalMinutes = 30 // Over 2 days: 30 minutes
|
||||
} else if (timeRangeMs > twelveHoursMs) {
|
||||
intervalMinutes = 10 // Over 12 hours: 10 minutes
|
||||
} else if (timeRangeMs > oneHourMs) {
|
||||
intervalMinutes = 5 // Over 1 hour: 5 minutes
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user