Skip to content

Fix millisecond/second mismatch in SQLite task visibility timeout - #33

Merged
djgrant merged 1 commit into
mainfrom
fix/sqlite-visibility-timeout-units
Jul 22, 2026
Merged

Fix millisecond/second mismatch in SQLite task visibility timeout#33
djgrant merged 1 commit into
mainfrom
fix/sqlite-visibility-timeout-units

Conversation

@djgrant

Copy link
Copy Markdown
Contributor

Fixes#32

SqliteTaskQueue.process() wrote visible_from as a millisecond timestamp while the DAO's visibility queries compared it against strftime('%s', 'now') (seconds), so a task claimed by a crashed worker stayed hidden ~55,000 years instead of five minutes.

Changes:

  • TaskQueueDao.getNextTask() and getTaskCount() now take a millisecond now value from JS and compare with visible_from <= $now, so all values share one unit and one clock.
  • Inserts set visible_from = 0 explicitly (matching makeVisible), so the column default no longer matters — existing databases created with the old seconds-based default keep working.
  • Exported SqliteTaskQueue from @yieldstar/sqlite-runtime and added the regression test suggested in the issue: claim a task, advance past the visibility window, and confirm a fresh queue can reclaim it.

@djgrant
djgrant merged commit bedcb44 into mainJul 22, 2026
0 of 2 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLite task visibility timeout mixes milliseconds and seconds

1 participant

@djgrant