Как пессимистить c блокировку - PullRequest
0 голосов
/ 07 августа 2020

Я хочу заблокировать свой стол, но это не сработало. Как мне с этим справиться? Ценю любой совет!

  • Typescript
  • Typeorm
  • Postgres
//src
    public async checkDBTable(builderAddress: string): Promise<boolean> {
        // 1. find DB table by key(builderAddress)
        // 2. return true({key: value} exist) or false
        const info: InfoEntity|undefined = await this.findOne(builderAddress, {
            lock: {mode: 'pessimistic_write'}
        });
        return nonceInfo !== undefined;
    }
//result
    error: PessimisticLockTransactionRequiredError: An open transaction is required for pessimistic lock.
...