【发布时间】:2019-11-22 00:49:43
【问题描述】:
我正在尝试在我的 Electron 应用程序中实现 SQLite3,以便在应用程序关闭时保存用户首选项(Electron 的“关闭”事件)和来自 API 的用户数据。此 API 数据可以随时从脚本的各个部分到达,需要保存。有问题的错误是 sqlite_busy: database is locked
我已经尝试将 SQLite3 的方法包装在一个承诺中,以便在单独的模块中与“async/await”一起使用,但这只能让我到目前为止。
- 如何实现它以保存 API 数据而不会遇到“锁定”问题?
- 如果应用在查询完成之前崩溃或关闭怎么办?
- 是否需要查询队列
// const queue = [];
// push query to the queue
// loop to check if the queue has a query to handle
// execute the query and remove it from the queue
【问题讨论】:
标签: javascript node.js sqlite electron