From 27e9b093bf3b4717866eff7c76413726656da1c2 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sat, 14 Oct 2023 17:20:21 -0700 Subject: [PATCH] timeline: enable aggregation for month view Signed-off-by: Varun Patil --- lib/Controller/DaysController.php | 6 ++---- src/components/Timeline.vue | 9 +++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/Controller/DaysController.php b/lib/Controller/DaysController.php index 69c4a39c..696e14bc 100644 --- a/lib/Controller/DaysController.php +++ b/lib/Controller/DaysController.php @@ -45,10 +45,8 @@ class DaysController extends GenericApiController $this->getTransformations(), ); - if (!$this->isMonthView()) { - // Preload some day responses - $this->preloadDays($list); - } + // Preload some day responses + $this->preloadDays($list); // Reverse response if requested. if ($this->isReverse()) { diff --git a/src/components/Timeline.vue b/src/components/Timeline.vue index 3ad58ce3..37213356 100644 --- a/src/components/Timeline.vue +++ b/src/components/Timeline.vue @@ -906,8 +906,13 @@ export default defineComponent({ // Aggregate fetch requests this.fetchDayQueue.push(dayId); - // Only single queries allowed for month vie - if (now || this.isMonthView) { + // If the queue has gotten large enough, just expire immediately + // This is to prevent a large number of requests from being queued + now ||= this.fetchDayQueue.length >= 16; + now ||= this.fetchDayQueue.reduce((sum, dayId) => sum + this.heads[dayId]?.day?.count ?? 0, 0) > 256; + + // Process immediately + if (now) { return this.fetchDayExpire(); }