@rotorsoft/act-tck 1.27.2 → 1.27.4
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/dist/.tsbuildinfo +1 -1
- package/dist/@types/store-tck.d.ts.map +1 -1
- package/dist/index.cjs +49 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1665,6 +1665,55 @@ var runStoreTck = (options) => {
|
|
|
1665
1665
|
const second = await store.claim(0, 100, `w-${uid()}`, 1);
|
|
1666
1666
|
expect8(second.find((l) => l.stream === s)).toBeDefined();
|
|
1667
1667
|
});
|
|
1668
|
+
it7("does not starve a default-priority lagging stream under sustained high-priority load (ACT-1223)", async () => {
|
|
1669
|
+
const fresh = await options.factory();
|
|
1670
|
+
try {
|
|
1671
|
+
await fresh.drop();
|
|
1672
|
+
await fresh.seed();
|
|
1673
|
+
const suffix = uid();
|
|
1674
|
+
const highs = Array.from(
|
|
1675
|
+
{ length: 6 },
|
|
1676
|
+
(_, i) => `hi-${i}-${suffix}`
|
|
1677
|
+
);
|
|
1678
|
+
const low = `lo-${suffix}`;
|
|
1679
|
+
await fresh.subscribe([
|
|
1680
|
+
...highs.map((stream) => ({ stream, priority: 100 })),
|
|
1681
|
+
{ stream: low, priority: 0 }
|
|
1682
|
+
]);
|
|
1683
|
+
for (const stream of highs)
|
|
1684
|
+
await fresh.commit(
|
|
1685
|
+
stream,
|
|
1686
|
+
[inc(1)],
|
|
1687
|
+
make_meta({ stream })
|
|
1688
|
+
);
|
|
1689
|
+
await fresh.commit(
|
|
1690
|
+
low,
|
|
1691
|
+
[inc(1)],
|
|
1692
|
+
make_meta({ stream: low })
|
|
1693
|
+
);
|
|
1694
|
+
const by = `w-${uid()}`;
|
|
1695
|
+
let low_claimed = false;
|
|
1696
|
+
const MAX_CYCLES = 20;
|
|
1697
|
+
for (let cycle = 0; cycle < MAX_CYCLES && !low_claimed; cycle++) {
|
|
1698
|
+
const leases = await fresh.claim(4, 0, by, 1e3);
|
|
1699
|
+
if (leases.some((l) => l.stream === low)) {
|
|
1700
|
+
low_claimed = true;
|
|
1701
|
+
break;
|
|
1702
|
+
}
|
|
1703
|
+
for (const l of leases) {
|
|
1704
|
+
await fresh.ack([{ ...l, at: l.at + 1 }]);
|
|
1705
|
+
await fresh.commit(
|
|
1706
|
+
l.stream,
|
|
1707
|
+
[inc(1)],
|
|
1708
|
+
make_meta({ stream: l.stream })
|
|
1709
|
+
);
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
expect8(low_claimed).toBe(true);
|
|
1713
|
+
} finally {
|
|
1714
|
+
await fresh.dispose();
|
|
1715
|
+
}
|
|
1716
|
+
});
|
|
1668
1717
|
it7("dedupes when both frontiers would return the same stream", async () => {
|
|
1669
1718
|
const s = `claim-dedup-${uid()}`;
|
|
1670
1719
|
await store.subscribe([{ stream: s }]);
|