Skip to content

Commit

Permalink
RFQ Relayer: check for db status mismatch (#2769)
Browse files Browse the repository at this point in the history
* Feat: check for status mismatch

* [goreleaser]

---------

Co-authored-by: Trajan0x <[email protected]>
  • Loading branch information
dwasse and trajan0x authored Jun 23, 2024
1 parent 87afd9b commit d3ef268
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions services/rfq/relayer/service/statushandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ func (r *Relayer) mutexMiddleware(next func(ctx context.Context, span trace.Span
}
defer unlocker.Unlock()

// make sure the status has not changed since we last saw it
dbReq, err := r.db.GetQuoteRequestByID(ctx, req.TransactionID)
if err != nil {
return fmt.Errorf("could not get request: %w", err)
}
if dbReq.Status != req.Status {
span.SetAttributes(
attribute.Bool("status_changed", true),
attribute.String("db_status", dbReq.Status.String()),
attribute.String("handler_status", req.Status.String()),
)
return nil
}

return next(ctx, span, req)
}
}
Expand Down

0 comments on commit d3ef268

Please sign in to comment.