Skip to content

Commit 125ae7e

Browse files
fix(table): dispatcher cursor starts at -1 so position 0 is included
The dispatcher's row-window SELECT is `position > cursor` for exclusive lower-bound semantics. With cursor initialized to 0, position-0 rows were never picked up — every dispatch silently skipped the table's first row. Start cursor at -1 instead. First window's filter `position > -1` matches position 0; subsequent iterations advance to `lastPosition` which then correctly excludes already-processed rows.
1 parent bd99d6c commit 125ae7e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

apps/sim/lib/table/dispatcher.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ export async function insertDispatch(input: {
119119
mode: input.mode,
120120
scope: input.scope,
121121
status: 'pending',
122-
cursor: 0,
122+
// -1 = "haven't started." First window's filter `position > -1` matches
123+
// position 0; subsequent iterations advance to `lastPosition` which then
124+
// correctly excludes already-processed rows.
125+
cursor: -1,
123126
isManualRun: input.isManualRun,
124127
})
125128
return id

0 commit comments

Comments
 (0)