Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add worker logs #99

Merged
merged 1 commit into from
Nov 25, 2024
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
1 change: 1 addition & 0 deletions internal/server/tradelogs/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func (s *Server) getTradeLogs(c *gin.Context) {
responseErr(c, http.StatusBadRequest, errors.New("max time range"))
return
}
s.l.Infow("get trade log query", "query", query)
data, err := s.s.Get(query)
if err != nil {
responseErr(c, http.StatusBadRequest, err)
Expand Down
2 changes: 2 additions & 0 deletions internal/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func (w *Worker) Run(ctx context.Context) error {
}
func (w *Worker) processMessages(m []evmlistenerclient.Message) error {
for _, message := range m {
w.l.Infow("about to process new message", "msg", message)
var (
insertOrders []storage.TradeLog
deleteBlocks []uint64
Expand All @@ -91,6 +92,7 @@ func (w *Worker) processMessages(m []evmlistenerclient.Message) error {
for _, block := range message.RevertedBlocks {
deleteBlocks = append(deleteBlocks, block.Number.Uint64())
if err := w.s.DeleteErrorLogsWithBlock(block.Hash); err != nil {
w.l.Infow("error when revert block", "blocks", deleteBlocks, "err", err)
return err
}
}
Expand Down
2 changes: 2 additions & 0 deletions v2/internal/server/tradelogs.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ func (s *TradeLogs) getTradeLogs(c *gin.Context) {
return
}

s.l.Infow("get trade log query", "query", query)

var data []storageTypes.TradeLog
for _, storage := range s.storage {
tradeLogs, err := storage.Get(query)
Expand Down
2 changes: 2 additions & 0 deletions v2/internal/worker/log_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ func (w *LogParser) Publish(ctx context.Context, topic string, data interface{})
func (w *LogParser) processMessage(msg types.Message) error {
var deleteBlocks []uint64

w.l.Infow("process message", "msg", msg)

for _, block := range msg.RevertedBlocks {
deleteBlocks = append(deleteBlocks, block.Number.Uint64())
}
Expand Down
Loading