Skip to content

Commit

Permalink
services/horizon: Resume ingestion immediately when catching up (#4196)
Browse files Browse the repository at this point in the history
When more than one ingesting instances is running and the current one is behind,
go to `resumeState` immediately instead of after 1s. Waiting 1s can slow down
make applying ledgers by Captive-Core slower in catching-up mode.
  • Loading branch information
bartekn authored Jan 28, 2022
1 parent d9a619d commit d3ce98c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions services/horizon/internal/ingest/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,8 @@ func (r resumeState) run(s *system) (transition, error) {
log.WithError(err).Warn("error updating stellar-core cursor")
}

return retryResume(resumeState{
latestSuccessfullyProcessedLedger: lastIngestedLedger,
}), nil
// resume immediately so Captive-Core catchup is not slowed down
return resumeImmediately(lastIngestedLedger), nil
}

ingestVersion, err := s.historyQ.GetIngestVersion(s.ctx)
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/ingest/resume_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func (s *ResumeTestTestSuite) TestBumpIngestLedger() {
s.Assert().Equal(
transition{
node: resumeState{latestSuccessfullyProcessedLedger: 101},
sleepDuration: defaultSleep,
sleepDuration: 0,
},
next,
)
Expand Down

0 comments on commit d3ce98c

Please sign in to comment.