mirror of
https://github.com/furyhawk/home_stack.git
synced 2026-07-21 02:06:47 +00:00
fix: adjust batch window size in fetchMetric for optimized data fetching based on range
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -156,8 +156,10 @@ const fetchMetric = async <TMetricKey extends FuryMetricKey>(
|
||||
const endMs = Date.now()
|
||||
const startMs = Math.max(0, endMs - summarySinceMs)
|
||||
|
||||
// size of each batch window (7 days)
|
||||
const batchMs = DAY_IN_MS * 7
|
||||
// size of each batch window. For short ranges (<= 7 days) fetch daily
|
||||
// batches so a 1-week range will request seven 1-day windows. For longer
|
||||
// ranges use 7-day windows to reduce iteration count.
|
||||
const batchMs = summarySinceMs <= DAY_IN_MS * 7 ? DAY_IN_MS : DAY_IN_MS * 7
|
||||
const maxIterations = 200
|
||||
|
||||
let currentEndMs = endMs
|
||||
|
||||
Reference in New Issue
Block a user