mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
perf(analytics): thread source-priority once through bp-in-target fast path
Load the source-priority blob once and pass it into both BP readers instead of letting each re-query the user. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
b45ca232fa
commit
b132abc789
1 file changed
+6
@@ -53,6 +53,7 @@
|
||||
import { prisma } from "@/lib/db";
|
||||
import { annotate } from "@/lib/logging/context";
|
||||
import { readRollupBuckets } from "@/lib/rollups/measurement-rollups";
|
||||
import { loadUserSourcePriority } from "@/lib/rollups/measurement-read";
|
||||
import {
|
||||
probeRollupCoverage,
|
||||
type RollupCoverageMap,
|
||||
@@ -197,6 +198,9 @@ async function computeFromRollups(
|
||||
return d;
|
||||
})();
|
||||
|
||||
// v1.11.2 — load the source-priority blob once and thread it into both
|
||||
// reads so the sys/dia fan-out doesn't re-query the user twice.
|
||||
const priority = await loadUserSourcePriority(userId);
|
||||
const [sysBuckets, diaBuckets] = await Promise.all([
|
||||
readRollupBuckets(
|
||||
userId,
|
||||
@@ -204,6 +208,7 @@ async function computeFromRollups(
|
||||
"DAY",
|
||||
readSince,
|
||||
now,
|
||||
priority,
|
||||
),
|
||||
readRollupBuckets(
|
||||
userId,
|
||||
@@ -211,6 +216,7 @@ async function computeFromRollups(
|
||||
"DAY",
|
||||
readSince,
|
||||
now,
|
||||
priority,
|
||||
),
|
||||
]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user