关键代码const tx = db.transaction(['items'], 'readwrite')
const store = tx.objectStore('items')
try {
for (const it of batch) store.put(it)
await tx.done
} catch (e) {
tx.abort()
}
验证与参数指标:事务耗时、失败率、回滚成功率注意事项避免长事务与锁等待;分批提交与进度显示
微信公众账号
微信扫一扫加关注
发表评论 取消回复