loopbackio / loopbackio/loopback-connector-postgresql

Error when using transaction timeout

未关闭
#471 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug
主要语言
JavaScript
星标
118
派生
184
平均合并
1 天 22 小时
30 天内合并 PR
5

描述

Steps to reproduce

loopback-connector-postgresql version is 5.3.0
node version is v14.1.0

await app.datasources.db.transaction(async myTxModels => {
    await customFunction(element, {
        db1: db1TxModels, 
        db2: db2Models
    }).catch(err => { throw err });

}, { timeout: 240000 });

Current Behavior

aftersome time, app crashes with the following error

tx.notifyObserversOf('timeout', context, function(err) {
           ^

TypeError: tx.notifyObserversOf is not a function
    at Timeout._onTimeout (\node_modules\loopback-connector\lib\transaction.js:124:12)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用 loopback-connector-postgresql 5.3.0 和 Node v14.1.0 重现事务超时,然后检查第 124 行的 node_modules/loopback-connector/lib/transaction.js 及其周围的超时处理逻辑。完成的标准是超时路径不再引发“tx.notifyObserversOf is not a function”或导致应用崩溃。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, node.js, postgresql
领域
backend, databases
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。