mirror of
https://github.com/open-webui/oikb.git
synced 2026-11-05 01:27:25 +00:00
[PR #35] [MERGED] fix(history): implement thread-safe connection pool for SQLite to fix resource leaks #87
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/oikb#87
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/oikb/pull/35
Author: @mhajder
Created: 6/6/2026
Status: ✅ Merged
Merged: 7/17/2026
Merged by: @tjbck
Base:
main← Head:fix/history📝 Commits (1)
a88b27cfix(history): implement thread-safe connection pool for SQLite to fix resource leaks📊 Changes
1 file changed (+107 additions, -51 deletions)
View changed files
📝
src/oikb/history.py(+107 -51)📄 Description
Refactors
SyncHistoryto use aqueue.Queueconnection pool instead ofthreading.local().Previously, connections tied to
threading.local()in a background worker pool would remain open until the thread died, leading to a steady leak of open file descriptors and locked connections.Changes:
threading.local()with a boundedqueue.Queuepool (size=5) ofsqlite3.Connectionobjects configured withcheck_same_thread=False.try...finallyblock to ensureclose()is called, fixing a silent file lock leak.PRAGMA synchronous=NORMALalongsidejournal_mode=WALfor drastically improved concurrent write performance without sacrificing durability.close()to gracefully drain the queue and explicitly terminate all pooled connections.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.