Is it possible to use transaction with web worker?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
I am just curious, will the transaction work as expected if I do this:
worker.postMessage({
id: 2,
action: "exec",
sql: "BEGIN TRANSACTION"
});
worker.postMessage({
id: 3,
action: "exec",
sql: "INSERT ...",
params: { "$id": 1 }
});
worker.postMessage({
id: 4,
action: "exec",
sql: "INSERT ...",
params: { "$id": 2 }
});
worker.postMessage({
id: 5,
action: "exec",
sql: "COMMIT"
});
How can I be sure, that only id 3, 4 will be committed in the current transaction? I mean, after the transaction started I can't guarantee that other async codes could be executed that could not relate to the current transaction(for example, when setTimeout happens). Is there something like the ID of the transaction, under which other queries should be executed?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or entry points. Start by reviewing how web-worker exec messages are handled and how SQLite transactions span asynchronous calls. Done would require a documented answer or a clearly scoped change, but the issue does not define which.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, sqlite
- Domain
- database, web-dev
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100