Sinatra + Chartkick + Sequel gem,图表未更新
Sinatra + Chartkick + Sequel gem, chart not updating
我是 运行 一个非常基本的 Sinatra 服务器,它只是显示我通过 Sequel gem 获得的一些数据的 Chartkick 图表。我注意到图表上的数据似乎没有更新,除非我退出 Sinatra 服务器脚本并重新运行它。我真的不明白这怎么可能...我在使用 Sequel 读取数据库时使用的唯一非正常选项是只读选项..这会导致这个吗?
事实证明,从这里阅读另一个 post:
First, by default, multiple processes can have the same SQLite
database open at the same time, and several read accesses can be
satisfied in parallel.
In case of writing, a single write to the database locks the database
for a short time, nothing, even reading, can access the database file
at all.
Beginning with version 3.7.0, a new “Write Ahead Logging” (WAL) option
is available, in which reading and writing can proceed concurrently.
By default, WAL is not enabled. To turn WAL on, refer to the SQLite
documentation.
我目前有脚本 A,它保持与数据库文件的连接并定期写入它,还有脚本 B,它是我的 Sinatra 服务器,它从该数据库文件读取信息。我通过在我的 Sinatra 脚本中使用块连接解决了这个问题。我不知道如何使用 Sequel 打开 WAL...
我是 运行 一个非常基本的 Sinatra 服务器,它只是显示我通过 Sequel gem 获得的一些数据的 Chartkick 图表。我注意到图表上的数据似乎没有更新,除非我退出 Sinatra 服务器脚本并重新运行它。我真的不明白这怎么可能...我在使用 Sequel 读取数据库时使用的唯一非正常选项是只读选项..这会导致这个吗?
事实证明,从这里阅读另一个 post:
First, by default, multiple processes can have the same SQLite database open at the same time, and several read accesses can be satisfied in parallel.
In case of writing, a single write to the database locks the database for a short time, nothing, even reading, can access the database file at all.
Beginning with version 3.7.0, a new “Write Ahead Logging” (WAL) option is available, in which reading and writing can proceed concurrently.
By default, WAL is not enabled. To turn WAL on, refer to the SQLite documentation.
我目前有脚本 A,它保持与数据库文件的连接并定期写入它,还有脚本 B,它是我的 Sinatra 服务器,它从该数据库文件读取信息。我通过在我的 Sinatra 脚本中使用块连接解决了这个问题。我不知道如何使用 Sequel 打开 WAL...