@harperfast/harper 5.0.20 → 5.0.21

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@harperfast/harper",
3
3
  "description": "Harper is an open-source Node.js performance platform that unifies database, cache, application, and messaging layers into one in-memory process.",
4
- "version": "5.0.20",
4
+ "version": "5.0.21",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://harper.fast",
7
7
  "bugs": {
@@ -311,6 +311,8 @@ export function makeTable(options) {
311
311
  ensureLoaded: false,
312
312
  nodeId: event.nodeId,
313
313
  viaNodeId: event.viaNodeId,
314
+ // use per-event expiresAt: batched txn context only holds the first event's expiration
315
+ expiresAt: event.expiresAt,
314
316
  async: true,
315
317
  };
316
318
  const id = event.id;
@@ -1685,7 +1687,8 @@ export function makeTable(options) {
1685
1687
  const type = fullUpdate ? 'put' : 'patch';
1686
1688
  let residencyId: number | undefined;
1687
1689
  if (options?.residencyId != undefined) residencyId = options.residencyId;
1688
- const expiresAt: number = context?.expiresAt ?? (expirationMs ? expirationMs + Date.now() : -1);
1690
+ const expiresAt: number =
1691
+ options?.expiresAt ?? context?.expiresAt ?? (expirationMs ? expirationMs + Date.now() : -1);
1689
1692
  const additionalAuditRefs: Array<{ version: number; nodeId: number }> = []; // track additional audit refs to store
1690
1693
 
1691
1694
  if (precedesExisting <= 0) {
@@ -1902,7 +1905,7 @@ export function makeTable(options) {
1902
1905
  updateIndices(id, existingRecord, recordToStore, transaction && { transaction });
1903
1906
 
1904
1907
  writeCommit(true);
1905
- if (context.expiresAt) scheduleCleanup();
1908
+ if (expiresAt >= 0) scheduleCleanup(); // arm for replicated writes too, not just local-context writes
1906
1909
  function writeCommit(storeRecord: boolean) {
1907
1910
  // we need to write the commit. if storeRecord then we need to store the record, otherwise we just need to store the audit record
1908
1911
  updateRecord(