Merge pull request #14655 from supabase/fix/prevent-filling-10k-datapoints

fix: prevent accidental filing of large timeseries datasets
This commit is contained in:
Ziinc authored and GitHub committed 2023-06-21 02:20:03 +08:00
commit d2c856cafa
1 file changed
+6
@@ -394,6 +394,12 @@ export const fillTimeseries = (
})
const diff = maxDate.diff(minDate, truncation as dayjs.UnitType)
// Intentional throwing of error here to be caught by Sentry, as this would indicate a bug since charts shouldn't be rendering more than 10k data points
if (diff > 10000) {
throw new Error(
'Data error, filling timeseries dynamically with more than 10k data points degrades performance.'
)
}
for (let i = 0; i <= diff; i++) {
const dateToMaybeAdd = minDate.add(i, truncation as dayjs.ManipulateType)