fix accountTx ref counting

This commit is contained in:
CJ Cobb
2021-02-11 17:23:41 -05:00
parent 069fd1a259
commit 2d481c3555
2 changed files with 5 additions and 2 deletions

View File

@@ -241,7 +241,9 @@ flatMapWriteAccountTxCallback(CassFuture* fut, void* cbData)
backend.throttleCv_.notify_all(); backend.throttleCv_.notify_all();
if (backend.numRequestsOutstanding_ == 0) if (backend.numRequestsOutstanding_ == 0)
backend.syncCv_.notify_all(); backend.syncCv_.notify_all();
delete &requestParams; int remaining = --requestParams.refs;
if (remaining == 0)
delete &requestParams;
} }
} }
void void

View File

@@ -1378,11 +1378,12 @@ public:
AccountTransactionsData data; AccountTransactionsData data;
uint32_t currentRetries = 0; uint32_t currentRetries = 0;
std::atomic<int> refs;
WriteAccountTxCallbackData( WriteAccountTxCallbackData(
CassandraFlatMapBackend const* f, CassandraFlatMapBackend const* f,
AccountTransactionsData&& data) AccountTransactionsData&& data)
: backend(f), data(std::move(data)) : backend(f), data(std::move(data)), refs(data.accounts.size())
{ {
} }
}; };