Skip to content

index on session_id, delete expired ai sessions async in batches#9500

Merged
pjain1 merged 4 commits into
mainfrom
runtime_start_blocking
May 26, 2026
Merged

index on session_id, delete expired ai sessions async in batches#9500
pjain1 merged 4 commits into
mainfrom
runtime_start_blocking

Conversation

@pjain1
Copy link
Copy Markdown
Member

@pjain1 pjain1 commented May 25, 2026

To prevent runtime start blocking

Took thread dump and found this hanging

goroutine 67 [runnable]:
modernc.org/sqlite/lib._sqlite3VdbeExec(...)
...
github.com/rilldata/rill/runtime/drivers/sqlite.(*connection).deleteExpiredAISessions(...)
    runtime/drivers/sqlite/migrate.go:166
github.com/rilldata/rill/runtime/drivers/sqlite.(*connection).Migrate(...)
    runtime/drivers/sqlite/migrate.go:81
github.com/rilldata/rill/runtime.(*Runtime).openAndMigrate(...)
    runtime/connection_cache.go:180
github.com/rilldata/rill/runtime/pkg/conncache.(*cacheImpl).beginOpen.func1()

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

Comment thread runtime/drivers/sqlite/migrate.go Outdated
Comment thread runtime/drivers/sqlite/migrate.go Outdated
Comment thread runtime/drivers/sqlite/migrate.go Outdated
Comment thread runtime/drivers/sqlite/migrations/0041.sql Outdated
@pjain1 pjain1 requested a review from begelundmuller May 26, 2026 12:32
Copy link
Copy Markdown
Contributor

@begelundmuller begelundmuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pjain1 pjain1 merged commit 7b37fb9 into main May 26, 2026
17 of 26 checks passed
@pjain1 pjain1 deleted the runtime_start_blocking branch May 26, 2026 13:57
pjain1 added a commit that referenced this pull request May 26, 2026
* index on session_id, delete expired ai sessions async in batches

* comment

* reduce batch size to 200

* review comments
Sign up for free to 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.

2 participants