问题描述
我向我的SQLite3数据库(ruby on rails API)发出了两次发布请求,我得到的是一个锁定的数据库:(
您能帮我吗?
addRecord() {
const value = this.newRecord;
if (!value) {
return;
}
this.$http.secured --------------------------------------------------->THIS ONE
.post("/api/v1/records/",{
record: {
description: this.newRecord.description,time: this.newRecord.time,path: this.selected.key,effect: this.selectedEff.key,template_id: this.newRecord.template
}
})
.then(response => {
this.records.push(response.data);
this.newRecord.description = "";
this.newRecord.time = "";
this.selected = "";
this.selectedEff = "";
this.newRecord.template = "";
this.$toasted.success("RECORD ADDED SUCCESSFULLY!",{
position: "top-center",duration: 3000,theme: "bubble"
});
// this.$router.go();
})
.catch(error =>
this.$toasted.error("ERROR,MAKE SURE EVERYTHING IS FILLED!",theme: "bubble"
})
);
this.$http.secured ----------------------------------------->AND THIS ONE
.post("/api/v1/logs/",{
log: {
action: this.newRecord.description,action_type: "CREATED",element: "RECORD"
}
})
.catch(error =>
this.$toasted.error("COULDNT CREATE LOG!",theme: "bubble"
})
);
},
现在我得到的是 500(内部服务器错误),说 SQLite3 :: BusyException:数据库已锁定
我已经尝试过在此站点上找到的每个答案都没有改变。
我试图像这样设置超时时间: database.yml :
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 10000
development:
<<: *default
database: db/development.sqlite3
test:
<<: *default
database: db/test.sqlite3
production:
adapter: sqlite3
database: db/mysite_prod.sqlite3
timeout: 10000
我已经在Rails控制台中尝试了 ActiveRecord::Base.connection.execute("BEGIN TRANSACTION; END;")
命令。似乎什么都没用,您能帮我吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)