reduce logging

This commit is contained in:
Ladd Hoffman 2025-01-01 22:31:07 -06:00
parent 65572a0e01
commit b4451a4d7a
1 changed files with 2 additions and 4 deletions

View File

@ -1,9 +1,9 @@
import Debug from 'debug';
// import Debug from 'debug';
import {EntityProperties} from "./entity.js";
import {CollapsedDelta, Lossless, LosslessViewOne} from "./lossless.js";
import {Lossy, valueFromCollapsedDelta} from './lossy.js';
import {DomainEntityID, PropertyID, PropertyTypes, Timestamp, ViewMany} from "./types.js";
const debug = Debug('rz:lossy:last-write-wins');
// const debug = Debug('rz:lossy:last-write-wins');
type TimestampedProperty = {
value: PropertyTypes,
@ -65,9 +65,7 @@ function reducer(acc: Accumulator, cur: LosslessViewOne): Accumulator {
}
for (const [key, deltas] of Object.entries(cur.propertyDeltas)) {
debug(`reducer: looking for value for key ${key}`);
const {value, timeUpdated} = lastValueFromDeltas(key, deltas) || {};
debug(`reducer: key ${key} value ${value} timeUpdated ${timeUpdated}`);
if (!value || !timeUpdated) continue;
if (timeUpdated > (acc[cur.id].properties[key]?.timeUpdated || 0)) {