update:优化性能问题
This commit is contained in:
@@ -99,6 +99,8 @@ const SHOT_EFFECT_WAIT_TIMEOUT_MS = 1200;
|
||||
const AUDIO_TIMEOUT_BASE = 3500;
|
||||
const AUDIO_TIMEOUT_PER_KEY = 2600;
|
||||
const AUDIO_TIMEOUT_MAX = 12000;
|
||||
const RUNTIME_DIAGNOSTIC_INTERVAL_MS = 60000;
|
||||
let lastRuntimeDiagnosticAt = 0;
|
||||
|
||||
const env = computed(() => {
|
||||
try {
|
||||
@@ -108,6 +110,19 @@ const env = computed(() => {
|
||||
}
|
||||
});
|
||||
|
||||
const maybeLogRuntimeStats = () => {
|
||||
if (env.value !== "develop" && env.value !== "trial") return;
|
||||
const now = Date.now();
|
||||
if (now - lastRuntimeDiagnosticAt < RUNTIME_DIAGNOSTIC_INTERVAL_MS) return;
|
||||
lastRuntimeDiagnosticAt = now;
|
||||
console.log("[training-runtime]", {
|
||||
scoreCount: scores.value.length,
|
||||
renderedTargetShotCount: Math.min(scores.value.length, 12),
|
||||
renderedScoreCardCount: Math.min(scores.value.length, 60) + 1,
|
||||
...audioManager.getRuntimeStats(),
|
||||
});
|
||||
};
|
||||
|
||||
const isDistanceStage = computed(() => pageStage.value === pageStages.DISTANCE);
|
||||
const isShootingStage = computed(() => pageStage.value === pageStages.SHOOTING);
|
||||
const hasPractiseResult = computed(() => !!practiseResult.value?.details);
|
||||
@@ -1111,6 +1126,7 @@ async function onReceiveMessage(msg) {
|
||||
scores.value = msg.details;
|
||||
hasNewShot = msg.details.length === previousScoreLength + 1;
|
||||
latestShot = hasNewShot ? msg.details[msg.details.length - 1] : null;
|
||||
maybeLogRuntimeStats();
|
||||
}
|
||||
|
||||
if (trainingType.value === "precision") {
|
||||
|
||||
Reference in New Issue
Block a user