使用transaction.get(query)时,firestore死锁

时间:2019-02-21 01:20:18

标签: java kotlin google-cloud-firestore

我正在使用Firestore Admin SDK for Java。

如果执行以下操作,则会出现死锁:

import aRandomFunction from "./random-function";

jest.mock("./random-function");

aRandomFunction.mockImplementation((data, dispatch) => {
  dispatch({ type: "MOCK_ACTION" );
});

repeat(100) { firestore.runTransaction { transaction -> val docSnapshot = transaction.get(query) .get() .documents .singleOrNull() // Use docSnapshot } } 调用发生死锁。另一方面,如果我在事务外部进行查询,并且仅通过引用在事务内部获取文档快照,则不会出现死锁。

为什么?我的方法有什么问题吗?

0 个答案:

没有答案