mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
Idle frame rate in the app, timed line batching, KEY REQUIRED status
Three fixes to how the globe draws and reports loading. **The idle frame rate is the app's rule.** The Cesium frame port capped the loop at `IDLE_FRAME_RATE` whenever nothing held it, so the rule lived inside the renderer. The render governor now sets the rate: the display's own while the loop is held, `IDLE_FRAME_RATE` while not. The frame port gains `onHeldChange(cb)`, which says when its first hold is taken and its last released (animated visual styles included), so the governor hears every hold. The quality setting's frame-rate cap is kept apart from the governor's rate, and the loop draws at the lower of the two, so neither overwrites the other. **Line batching is timed.** A line set waited 30 drawn frames before its unchanged lines settled into a static batch (300 for the long wait), so the batch built twice as fast at 120 Hz as at 60 Hz, and took seconds at the idle rate. It now waits `SETTLE_MS` (500 ms) and `LONG_SETTLE_MS` (5 s), and moved shapes go back into their batches on the same timing. **KEY REQUIRED.** A layer that cannot load without a provider key ended the global status chip LOAD FAILED. The chip now has a KEY REQUIRED outcome, ranked below a real failure: a layer whose stats say `keyRequired` ends KEY REQUIRED, any other failure still ends LOAD FAILED. Vessels report a missing AISStream key as `keyRequired` and name the key in the panel; a later outage clears it, as it is no longer the key that is missing. Checked: the full suite (new tests for `onHeldChange`, the quality cap against the governor's rate, timed settling, and the chip with and without a key), format, boundaries, build, the stub renderer boot and the Cesium conformance run; in the browser, the idle and held frame rates; and the first-run check now asserts that with no keys set the chip never says LOAD FAILED.
This commit is contained in:
1 parent
84d3e7b5ce
commit
0ed6cde956
33 files changed
+629
-179
No files matched your search
+31
-15
@@ -82,16 +82,22 @@ export function normalizeLayerLoading(layer = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* A batch's ending from its layers' stats: a layer that failed fails it; a
|
||||
* layer only waiting for its provider key (whose error is that missing key)
|
||||
* ends it KEY REQUIRED, which asks the user to act rather than reporting a
|
||||
* fault.
|
||||
*/
|
||||
function terminalFromParticipantStats(summary, participantIds) {
|
||||
if (!participantIds?.length) return null;
|
||||
const participants = new Set(participantIds);
|
||||
return summary.records.some(
|
||||
(record) =>
|
||||
participants.has(record.id) &&
|
||||
(record.error || record.unavailable || record.keyRequired),
|
||||
)
|
||||
? 'error'
|
||||
: null;
|
||||
let keyRequired = false;
|
||||
for (const record of summary.records) {
|
||||
if (!participants.has(record.id)) continue;
|
||||
if (record.keyRequired) keyRequired = true;
|
||||
else if (record.error || record.unavailable) return 'error';
|
||||
}
|
||||
return keyRequired ? 'key-required' : null;
|
||||
}
|
||||
|
||||
/** Aggregate all manager layers without changing their lifecycle authority. */
|
||||
@@ -272,17 +278,26 @@ export function reduceTrafficSyncFeedback(
|
||||
};
|
||||
}
|
||||
|
||||
function terminalFromEvent(event) {
|
||||
/**
|
||||
* A lifecycle event's ending. A layer that failed only for want of its
|
||||
* provider key (its stats say `keyRequired`) ends KEY REQUIRED on every
|
||||
* load or refresh, not just the first.
|
||||
*/
|
||||
function terminalFromEvent(event, summary) {
|
||||
const type = String(event?.type || '');
|
||||
if (type === 'visibility-failed' || type === 'refresh-failed' || event?.error)
|
||||
return 'error';
|
||||
return summary?.records?.some(
|
||||
(record) => record.id === event?.layerId && record.keyRequired,
|
||||
)
|
||||
? 'key-required'
|
||||
: 'error';
|
||||
if (type === 'visibility-cancelled' || event?.cancelled) return 'cancelled';
|
||||
if (type === 'visibility' || type === 'refresh') return 'complete';
|
||||
return null;
|
||||
}
|
||||
|
||||
function mergeTerminalOutcome(current, next) {
|
||||
const severity = { complete: 1, cancelled: 2, error: 3 };
|
||||
const severity = { complete: 1, cancelled: 2, 'key-required': 3, error: 4 };
|
||||
if (!next) return current || null;
|
||||
if (!current || severity[next] > severity[current]) return next;
|
||||
return current;
|
||||
@@ -306,7 +321,7 @@ export function reduceLoadingFeedback(previous, summary, nowMs, event = null) {
|
||||
beginning ? null : state.batchOutcome,
|
||||
terminalFromParticipantStats(summary, activeIds),
|
||||
),
|
||||
eventParticipates ? terminalFromEvent(event) : null,
|
||||
eventParticipates ? terminalFromEvent(event, summary) : null,
|
||||
);
|
||||
return {
|
||||
phase: 'loading',
|
||||
@@ -325,7 +340,7 @@ export function reduceLoadingFeedback(previous, summary, nowMs, event = null) {
|
||||
failedEventIds: [
|
||||
...new Set([
|
||||
...(beginning ? [] : state.failedEventIds || []),
|
||||
...(eventParticipates && terminalFromEvent(event) === 'error'
|
||||
...(eventParticipates && terminalFromEvent(event, summary) === 'error'
|
||||
? [eventLayerId]
|
||||
: []),
|
||||
]),
|
||||
@@ -343,13 +358,13 @@ export function reduceLoadingFeedback(previous, summary, nowMs, event = null) {
|
||||
state.batchOutcome,
|
||||
terminalFromParticipantStats(summary, state.activeIds),
|
||||
),
|
||||
eventParticipates ? terminalFromEvent(event) : null,
|
||||
eventParticipates ? terminalFromEvent(event, summary) : null,
|
||||
) || 'complete';
|
||||
const wasVisible = state.visible || now >= state.showAt;
|
||||
if (!wasVisible && terminal === 'complete')
|
||||
return createLoadingFeedbackState();
|
||||
const dwell =
|
||||
terminal === 'error'
|
||||
terminal === 'error' || terminal === 'key-required'
|
||||
? LOADING_FAILURE_DWELL_MS
|
||||
: LOADING_TERMINAL_DWELL_MS;
|
||||
return {
|
||||
@@ -362,7 +377,7 @@ export function reduceLoadingFeedback(previous, summary, nowMs, event = null) {
|
||||
failedEventIds: [
|
||||
...new Set([
|
||||
...(state.failedEventIds || []),
|
||||
...(eventParticipates && terminalFromEvent(event) === 'error'
|
||||
...(eventParticipates && terminalFromEvent(event, summary) === 'error'
|
||||
? [eventLayerId]
|
||||
: []),
|
||||
]),
|
||||
@@ -424,6 +439,7 @@ export function presentLoadingFeedback(state, summary, nowMs) {
|
||||
const labels = {
|
||||
complete: 'LOAD COMPLETE',
|
||||
cancelled: 'LOAD CANCELLED',
|
||||
'key-required': 'KEY REQUIRED',
|
||||
error: 'LOAD FAILED',
|
||||
};
|
||||
const label =
|
||||
|
||||
Reference in new issue
Block a user