mirror of https://gitee.com/bigwinds/arangodb
fix race in _batchPingTimer shutdown (#8801)
This commit is contained in:
parent
d3a152bfad
commit
c054cddfe5
|
@ -54,13 +54,19 @@ void InitialSyncer::startRecurringBatchExtension() {
|
|||
if (secs < 30) {
|
||||
secs = 30;
|
||||
}
|
||||
|
||||
std::weak_ptr<Syncer> self(shared_from_this());
|
||||
_batchPingTimer = SchedulerFeature::SCHEDULER->queueDelay(
|
||||
RequestLane::SERVER_REPLICATION, std::chrono::seconds(secs), [this](bool cancelled) {
|
||||
if (!cancelled && _batch.id != 0 && !isAborted()) {
|
||||
_batch.extend(_state.connection, _progress);
|
||||
startRecurringBatchExtension();
|
||||
} else {
|
||||
_batchPingTimer.reset();
|
||||
RequestLane::SERVER_REPLICATION, std::chrono::seconds(secs), [self](bool cancelled) {
|
||||
if (!cancelled) {
|
||||
auto syncer = self.lock();
|
||||
if (syncer) {
|
||||
InitialSyncer* s = static_cast<InitialSyncer*>(syncer.get());
|
||||
if (s->_batch.id != 0 && !s->isAborted()) {
|
||||
s->_batch.extend(s->_state.connection, s->_progress);
|
||||
s->startRecurringBatchExtension();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ class InitialSyncer : public Syncer {
|
|||
protected:
|
||||
replutils::BatchInfo _batch;
|
||||
replutils::ProgressInfo _progress;
|
||||
|
||||
/// recurring task to keep the batch alive
|
||||
Scheduler::WorkHandle _batchPingTimer;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue