【发布时间】:2013-04-14 01:40:11
【问题描述】:
我正在运行一个事务来更新需要存储在两个键中的项目。为此,我设置了一个嵌套事务,如下所示,它似乎按预期运行:
firebaseOOO.child('relationships/main').child(accountID).child(friendAccountID).transaction(function(data) {
data.prop = 'newval';
firebaseOOO.child('relationships/main').child(friendAccountID).child(accountID).transaction(function(data) {
return r;
});
return r;
});
这是否有任何陷阱或可能的意外影响?我最担心在负载下陷入某种事务循环,每个事务都会取消另一个事务,迫使它们都重新启动,或类似的情况。
有没有更好的方法来做到这一点?
我正在使用 NodeJS 客户端。
【问题讨论】:
-
为什么不尝试多位置更新? - firebase.googleblog.com/2015/09/…