Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions resources/Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,8 @@ export function makeTable(options) {
ensureLoaded: false,
nodeId: event.nodeId,
viaNodeId: event.viaNodeId,
// use per-event expiresAt: batched txn context only holds the first event's expiration
expiresAt: event.expiresAt,
async: true,
};
const id = event.id;
Expand Down Expand Up @@ -1685,7 +1687,8 @@ export function makeTable(options) {
const type = fullUpdate ? 'put' : 'patch';
let residencyId: number | undefined;
if (options?.residencyId != undefined) residencyId = options.residencyId;
const expiresAt: number = context?.expiresAt ?? (expirationMs ? expirationMs + Date.now() : -1);
const expiresAt: number =
options?.expiresAt ?? context?.expiresAt ?? (expirationMs ? expirationMs + Date.now() : -1);
const additionalAuditRefs: Array<{ version: number; nodeId: number }> = []; // track additional audit refs to store

if (precedesExisting <= 0) {
Expand Down Expand Up @@ -1902,7 +1905,7 @@ export function makeTable(options) {
updateIndices(id, existingRecord, recordToStore, transaction && { transaction });

writeCommit(true);
if (context.expiresAt) scheduleCleanup();
if (expiresAt >= 0) scheduleCleanup(); // arm for replicated writes too, not just local-context writes
function writeCommit(storeRecord: boolean) {
// we need to write the commit. if storeRecord then we need to store the record, otherwise we just need to store the audit record
updateRecord(
Expand Down
Loading