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) {
|
if (secs < 30) {
|
||||||
secs = 30;
|
secs = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::weak_ptr<Syncer> self(shared_from_this());
|
||||||
_batchPingTimer = SchedulerFeature::SCHEDULER->queueDelay(
|
_batchPingTimer = SchedulerFeature::SCHEDULER->queueDelay(
|
||||||
RequestLane::SERVER_REPLICATION, std::chrono::seconds(secs), [this](bool cancelled) {
|
RequestLane::SERVER_REPLICATION, std::chrono::seconds(secs), [self](bool cancelled) {
|
||||||
if (!cancelled && _batch.id != 0 && !isAborted()) {
|
if (!cancelled) {
|
||||||
_batch.extend(_state.connection, _progress);
|
auto syncer = self.lock();
|
||||||
startRecurringBatchExtension();
|
if (syncer) {
|
||||||
} else {
|
InitialSyncer* s = static_cast<InitialSyncer*>(syncer.get());
|
||||||
_batchPingTimer.reset();
|
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:
|
protected:
|
||||||
replutils::BatchInfo _batch;
|
replutils::BatchInfo _batch;
|
||||||
replutils::ProgressInfo _progress;
|
replutils::ProgressInfo _progress;
|
||||||
|
|
||||||
/// recurring task to keep the batch alive
|
/// recurring task to keep the batch alive
|
||||||
Scheduler::WorkHandle _batchPingTimer;
|
Scheduler::WorkHandle _batchPingTimer;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue