Commit c24af4e
fix(replication): propagate per-event expiresAt to record writes
Two issues prevented replicated records from being evicted:
1. The `options` object passed to `_writeUpdate` for each replicated
event did not include `expiresAt`. In a multi-record transaction batch
every event after the first uses the first event as `context`, so
`context.expiresAt` would silently apply the wrong expiration (or
none) to subsequent records.
2. `_writeUpdate` read `expiresAt` only from `context`, so per-event
options were ignored. Now: `options?.expiresAt ?? context?.expiresAt ?? fallback`.
3. `scheduleCleanup()` was only armed when `context.expiresAt` was
truthy, missing replicated writes that carry expiration via options.
Changed to `if (expiresAt >= 0)` to cover both paths.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent e24fb0e commit c24af4e
1 file changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
| 314 | + | |
| 315 | + | |
314 | 316 | | |
315 | 317 | | |
316 | 318 | | |
| |||
1685 | 1687 | | |
1686 | 1688 | | |
1687 | 1689 | | |
1688 | | - | |
| 1690 | + | |
| 1691 | + | |
1689 | 1692 | | |
1690 | 1693 | | |
1691 | 1694 | | |
| |||
1902 | 1905 | | |
1903 | 1906 | | |
1904 | 1907 | | |
1905 | | - | |
| 1908 | + | |
1906 | 1909 | | |
1907 | 1910 | | |
1908 | 1911 | | |
| |||
0 commit comments