Is it possible to use transaction with web worker?
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 13.7k
- 派生
- 1.1k
- PR 合并指标
- 30 天内没有已合并 PR
描述
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?
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
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.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, sqlite
- 领域
- database, web-dev
- Issue 类型
- 文档
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100