这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@jwaltz
Copy link
Contributor

@jwaltz jwaltz commented Jun 10, 2023

I was getting errors when inserting a large .docx ("wordCount": 225518, "token_count_estimate": 47635) file's vectorIds into the document_vectors table:

Error: SQLITE_BUSY: database is locked

I took a look at the bulkInsert() method in server/models/vectors.js and noticed it was executing INSERT statements in a loop. Sqlite supports batch inserts so I converted the INSERT statement to a single insert with multiple parameters to account for all of the vectorIds.

My LSP formatter/linter might have changed a bit of the formatting of the method signatures but I hope the PR is still valuable/valid. Let me know if I can fix anything.

Thanks!

@jwaltz jwaltz changed the title fix: convert insert loop to 1 insert stmt refactor: convert insert loop to 1 insert stmt Jun 10, 2023
@timothycarambat timothycarambat self-assigned this Jun 11, 2023
@timothycarambat
Copy link
Member

@jwaltz any chance you can run yarn lint from the root to lint all files then re-commit those changes? Theres a lot of delta and its mostly formatting so its hard to see the true delta.

Appreciate you 🙏

@jwaltz
Copy link
Contributor Author

jwaltz commented Jun 12, 2023

@timothycarambat sure thing, linted and added commit.

Copy link
Member

@timothycarambat timothycarambat left a comment

Choose a reason for hiding this comment

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

You are awesome - this will help resolve a ton of issues 🙏

@timothycarambat timothycarambat merged commit 84a5707 into Mintplex-Labs:master Jun 13, 2023
cabwds pushed a commit to cabwds/anything-llm that referenced this pull request Jul 3, 2025
* fix: convert insert loop to 1 insert stmt

* chore: lint
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