Avoid passing self to watch actor
This commit is contained in:
parent
cdb6bbfc85
commit
f6af6ec777
|
@ -2146,13 +2146,9 @@ void Watch::setWatch(Future<Void> watchFuture) {
|
|||
}
|
||||
|
||||
//FIXME: This seems pretty horrible. Now a Database can't die until all of its watches do...
|
||||
ACTOR Future<Void> watch( Reference<Watch> watch, Database cx, Transaction *self ) {
|
||||
state TransactionInfo info = self->info;
|
||||
ACTOR Future<Void> watch(Reference<Watch> watch, Database cx, TransactionInfo info) {
|
||||
cx->addWatch();
|
||||
try {
|
||||
self->watches.push_back(watch);
|
||||
self = nullptr; // This actor may outlive *self
|
||||
|
||||
choose {
|
||||
// RYOW write to value that is being watched (if applicable)
|
||||
// Errors
|
||||
|
@ -2191,7 +2187,9 @@ Future<Version> Transaction::getRawReadVersion() {
|
|||
|
||||
Future< Void > Transaction::watch( Reference<Watch> watch ) {
|
||||
++cx->transactionWatchRequests;
|
||||
return ::watch(watch, cx, this);
|
||||
cx->addWatch();
|
||||
watches.push_back(watch);
|
||||
return ::watch(watch, cx, info);
|
||||
}
|
||||
|
||||
ACTOR Future<Standalone<VectorRef<const char*>>> getAddressesForKeyActor(Key key, Future<Version> ver, Database cx,
|
||||
|
|
Loading…
Reference in New Issue