Skip to content

Commit

Permalink
add retry on syncClosedChannels as on startup it takes time for the L…
Browse files Browse the repository at this point in the history
…ND API to bre ready and build the arbitrars.
  • Loading branch information
roeierez committed Dec 22, 2019
1 parent 37caa35 commit 0918560
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions account/payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,19 @@ func (a *Service) watchPayments() {
if err := a.syncSentPayments(); err != nil {
a.log.Errorf("failed to sync payments: %v", err)
}
if err := a.syncClosedChannels(); err != nil {
a.log.Errorf("failed to sync closed chanels: %v", err)
}
go func() {
retry := 0
for retry < 3 {
if err := a.syncClosedChannels(); err != nil {
a.log.Errorf("failed to sync closed chanels retry:%v error: %v", retry, err)
time.Sleep(4 * time.Second)
retry++
continue
}
return
}
}()

_, lastInvoiceSettledIndex := a.breezDB.FetchPaymentsSyncInfo()
a.log.Infof("last invoice settled index ", lastInvoiceSettledIndex)
ctx, cancel := context.WithCancel(context.Background())
Expand Down

0 comments on commit 0918560

Please sign in to comment.