Skip to content

Commit

Permalink
Fix logging in OrderBookStream (#2699)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirms authored Jun 17, 2020
1 parent 2ed3ba3 commit c157ce9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions services/horizon/internal/expingest/orderbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,13 @@ func addOfferToGraph(graph orderbook.OBGraph, offer history.Offer) {
// update returns true if the order book graph was reset
func (o *OrderBookStream) update(status ingestionStatus) (bool, error) {
reset := o.lastLedger == 0
if status.StateInvalid || !status.HistoryConsistentWithState {
if status.StateInvalid {
log.WithField("status", status).Warn("ingestion state is invalid")
reset = true
} else if !status.HistoryConsistentWithState {
log.WithField("status", status).
Info("ingestion state not consistent with ingested history")
reset = true
} else if status.LastIngestedLedger < o.lastLedger {
log.WithField("status", status).
WithField("last_ledger", o.lastLedger).
Expand All @@ -124,8 +128,6 @@ func (o *OrderBookStream) update(status ingestionStatus) (bool, error) {

// wait until offers in horizon db is valid before populating order book graph
if status.StateInvalid || !status.HistoryConsistentWithState {
log.WithField("status", status).
Info("waiting for ingestion to update offers table")
return true, nil
}

Expand Down

0 comments on commit c157ce9

Please sign in to comment.