querysub 0.487.0 → 0.488.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -92,11 +92,7 @@ class ValidStateComputer {
|
|
|
92
92
|
return true;
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
// For any value we're the authority on that we already have, swap in our own stored copy. The data
|
|
96
|
-
// is immutable per (path, time) — only the valid state can differ, and we own that — so we must never
|
|
97
|
-
// adopt a sibling authority's valid state. Remapping (rather than only skipping the re-ingest) keeps
|
|
98
|
-
// everything downstream (valuesChanged, dependenciesChanged) on a single object instead of a mix of
|
|
99
|
-
// our copy and the remote's.
|
|
95
|
+
// For any value we're the authority on that we already have, swap in our own stored copy. The data is immutable per (path, time) — only the valid state can differ, and we own that — so we must never adopt a sibling authority's valid state. Remapping (rather than only skipping the re-ingest) keeps everything downstream (valuesChanged, dependenciesChanged) on a single object instead of a mix of our copy and the remote's.
|
|
100
96
|
pathValues = pathValues.map(value => {
|
|
101
97
|
if (!PathRouter.isSelfAuthority(value.path)) return value;
|
|
102
98
|
return authorityStorage.getValueExactMaybeRejected(value.path, value.time) || value;
|
|
@@ -125,7 +121,9 @@ class ValidStateComputer {
|
|
|
125
121
|
dependenciesChanged.add(watcher);
|
|
126
122
|
}
|
|
127
123
|
|
|
128
|
-
|
|
124
|
+
// We don't compute the valid state for values we don't own, but we still forward them to our watchers, and that must include accept transitions, not only rejects — otherwise a watcher we already forwarded a reject to stays stuck once the authority accepts. Ingest happens further below, so getValueExactMaybeRejected still returns our previous value here; only trigger when the incoming valid differs from what we currently hold, so we forward real changes without re-triggering on unchanged re-sends.
|
|
125
|
+
let prevValidState = authorityStorage.getValueExactMaybeRejected(value.path, value.time)?.valid;
|
|
126
|
+
if (prevValidState !== value.valid) {
|
|
129
127
|
initialTriggers.initialTriggerNonHistoryWatchers.add(value.path);
|
|
130
128
|
}
|
|
131
129
|
}
|
|
@@ -232,10 +230,8 @@ class ValidStateComputer {
|
|
|
232
230
|
for (let validStateChange of validStateChanged) {
|
|
233
231
|
valuesChanged.add(validStateChange);
|
|
234
232
|
|
|
235
|
-
//
|
|
236
|
-
|
|
237
|
-
initialTriggers.initialTriggerNonHistoryWatchers.add(validStateChange.path);
|
|
238
|
-
}
|
|
233
|
+
// Push the latest value to this path's (possibly cross-node) watchers on ANY valid-state change, not just rejections — external watchers are only re-notified via initialTriggerNonHistoryWatchers; valuesChanged alone propagates between co-authorities and never re-notifies a watcher that already holds a stale verdict, so without notifying on accepts a reject→accept recovery is computed correctly on the authority but the watcher stays stuck on the earlier rejected value.
|
|
234
|
+
initialTriggers.initialTriggerNonHistoryWatchers.add(validStateChange.path);
|
|
239
235
|
|
|
240
236
|
// // NOTE: As of right now, I think the only reason to force an initial trigger in this case is so that we can bust all the values through the query sub http server to the clients. Because if we just tell the HTTP server that one value has been rejected, it can go tell its clients, but that won't give them the latest value. Which isn't great. We should really have something where we can tell them. HMM...
|
|
241
237
|
// // IMPORTANT! The consequence of this is that if someone predicts a value, sends it to us, it's not valid, we will see it's not valid, and we will tell all of the nodes that are watching that path about all of the values on that path. This is inefficient. However, rejected values should be quite rare, so it shouldn't be too inefficient.
|