Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Replicator/ChangesFeed.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ namespace litecore::repl {
return true;
}

void ChangesFeed::stopObserving() { _changeObserver.reset(); }

// Overridden by ReplicatorChangesFeed
bool ChangesFeed::getRemoteRevID(RevToSend* rev, C4Document* doc) const { return true; }

Expand Down
2 changes: 2 additions & 0 deletions Replicator/ChangesFeed.hh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ namespace litecore::repl {
/** Returns true if the given rev matches the push filters. */
[[nodiscard]] virtual bool shouldPushRev(RevToSend* NONNULL) const;

void stopObserving();

protected:
std::string loggingClassName() const override { return "ChangesFeed"; }

Expand Down
5 changes: 5 additions & 0 deletions Replicator/Pusher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,11 @@ namespace litecore::repl {
return level;
}

void Pusher::changedStatus() {
if ( status().level == kC4Stopped ) _changesFeed.stopObserving();
Worker::changedStatus();
}

void Pusher::afterEvent() {
// If I would otherwise go idle or stop, but there are revs I want to retry, restart them:
if ( !_revsToRetry.empty() && connected() && !isBusy() ) retryRevs(std::move(_revsToRetry), false);
Expand Down
2 changes: 2 additions & 0 deletions Replicator/Pusher.hh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ namespace litecore::repl {
void _connectionClosed() override;
ActivityLevel computeActivityLevel(std::string* reason) const override;

void changedStatus() override;

private:
void _start();
bool isBusy(std::string* reason = nullptr) const;
Expand Down
Loading