@mblaney/holster 2.2.2 → 2.2.3

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mblaney/holster",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Holster is a service that allows synchronising data between devices using Node, Deno, Bun or the browser.",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/src/wire.js CHANGED
@@ -497,7 +497,15 @@ const Wire = opt => {
497
497
  })
498
498
 
499
499
  if (ack) {
500
- if (!isNode) {
500
+ // Put requests only need a local answer - skip the wire round-trip
501
+ // (matches the same check below, once store.get is reached instead
502
+ // of this fast graph path). Without this, check()'s own bare
503
+ // full-node lookup - always {put: true} - re-sends on the wire every
504
+ // time it's called once the soul's been through store.get once (see
505
+ // hasNode above), and since its own reply re-enters put() and calls
506
+ // check() again, this becomes a self-sustaining loop: a get every
507
+ // ~recentCheckTTL, forever, per soul, for every soul ever fetched.
508
+ if (!isNode && !_opt.put) {
501
509
  // Client: send request on the wire to check for updates,
502
510
  // since it may have missed puts while disconnected.
503
511
  // Skip if the same lex was checked recently to avoid flooding.
package/ts/src/wire.ts CHANGED
@@ -556,7 +556,15 @@ const Wire = (opt: HolsterOptions): WireAPI => {
556
556
  })
557
557
 
558
558
  if (ack) {
559
- if (!isNode) {
559
+ // Put requests only need a local answer - skip the wire round-trip
560
+ // (matches the same check below, once store.get is reached instead
561
+ // of this fast graph path). Without this, check()'s own bare
562
+ // full-node lookup - always {put: true} - re-sends on the wire every
563
+ // time it's called once the soul's been through store.get once (see
564
+ // hasNode above), and since its own reply re-enters put() and calls
565
+ // check() again, this becomes a self-sustaining loop: a get every
566
+ // ~recentCheckTTL, forever, per soul, for every soul ever fetched.
567
+ if (!isNode && !opts.put) {
560
568
  // Client: send request on the wire to check for updates,
561
569
  // since it may have missed puts while disconnected.
562
570
  // Skip if the same lex was checked recently to avoid flooding.