发出POST请求时,SQLite3数据库被锁定

问题描述

我向我的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 (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...