Clarify caveat comment

This commit is contained in:
7400
2024-03-02 11:04:24 -08:00
parent 4a076ddde7
commit f5c2c8c3d4

View File

@@ -159,12 +159,12 @@ export async function jBars (from, to, res) {
} }
} }
// noData should be set only if no samples in interval and earlier. // noData should be set only if no bars are in the requested period and earlier.
// In our case, we are guaranteed to have contiguous samples. // In our case, we are guaranteed to have contiguous samples.
// So we only return zero bars if: // So we only return no bars (bars.length==0) if:
// 1. interval is before first data available. // 1. period is entirely before first data available.
// 2. interval is after last data available. // 2. period is entirely after last data available.
// Returning no samples based on length works assuming that TV never asks for case 2. // Returning noData based on bars.length works perfectly assuming that TV never asks for case 2.
// This is probably not a safe assumption. The alternative would be to search // This is probably not a safe assumption. The alternative would be to search
// backward to find beginning of history. How far to search? // backward to find beginning of history. How far to search?