| … | … | @@ -66,7 +66,12 @@ export class DidPeer { |
| 66 | 66 | // FULL seed so this node can serve the cores to others (download all + follow appends) — this is |
| 67 | 67 | // the "each peer seeds" torrent behaviour; a read-only consumer that does NOT want to seed can |
| 68 | 68 | // subclass/override, but seeding-by-default is the P2P-native contribution posture. |
| 69 | | const seed = (core) => { const pull = () => { try { core.download({ start: 0, end: -1 }) } catch {} }; pull(); core.on('append', pull) } |
| 69 | // ONE live download range per core: end:-1 downloads all current blocks AND follows future appends |
| 70 | // (verified), so a single call is sufficient. The prior form re-ran `core.download({0,-1})` inside a |
| 71 | // `core.on('append', …)` listener — every append minted a NEW, never-destroyed [0,-1] RangeRequest and |
| 72 | // added another append listener, an UNBOUNDED range/listener leak that a re-authoring or ballooning |
| 73 | // producer turned into runaway replication churn (the ~100MB/s "never settles" amplifier). |
| 74 | const seed = (core) => { try { core.download({ start: 0, end: -1 }) } catch {} } |
| 70 | 75 | seed(this.repo.core); seed(this.seq.core) |
| 71 | 76 | // EVENT-DRIVEN: re-derive the served head on every firehose append (local or replicated), and |
| 72 | 77 | // re-announce the new length to connected peers. No poll loop. |