Skip to content

Commit

Permalink
Merge pull request #11434 from vegaprotocol/11399-reduce-logs
Browse files Browse the repository at this point in the history
fix: demote order-spam logs to debug and avoid data-node warning log
  • Loading branch information
jeremyletang authored Jul 10, 2024
2 parents 244a187 + 1ed6a84 commit f3d2d75
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
11 changes: 8 additions & 3 deletions core/collateral/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ func (e *Engine) CheckOrderSpamAllMarkets(party string) error {
func (e *Engine) CheckOrderSpam(party, market string, assets []string) error {
e.cacheLock.RLock()
defer e.cacheLock.RUnlock()
e.log.Info("CheckOrderSpam", logging.String("party", party), logging.String("market", market), logging.Strings("assets", assets))

if e.log.IsDebug() {
e.log.Debug("CheckOrderSpam", logging.String("party", party), logging.String("market", market), logging.Strings("assets", assets))
}
if assetBalances, ok := e.partyAssetCache[party]; !ok {
return fmt.Errorf("party " + party + " is not eligible to submit order transactions in market " + market + " (no general account in no asset)")
} else {
Expand All @@ -225,8 +228,10 @@ func (e *Engine) CheckOrderSpam(party, market string, assets []string) error {
}
}
if !found {
for ast, balance := range e.partyAssetCache[party] {
e.log.Info("party asset cache", logging.String("party", party), logging.String("asset", ast), logging.String("balance", balance.String()))
if e.log.IsDebug() {
for ast, balance := range e.partyAssetCache[party] {
e.log.Debug("party asset cache", logging.String("party", party), logging.String("asset", ast), logging.String("balance", balance.String()))
}
}
return fmt.Errorf("party " + party + " is not eligible to submit order transactions in market " + market + " (no general account found)")
}
Expand Down
12 changes: 8 additions & 4 deletions datanode/sqlsubscribers/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,15 @@ func (os *Order) cancelled(ctx context.Context, co CancelledOrdersEvent, seqNum
ids = append(ids, id)
}
}
ncOrders, err := os.store.GetByMarketAndID(ctx, co.MarketID(), ids)
if err != nil {
return err

if len(ids) > 0 {
ncOrders, err := os.store.GetByMarketAndID(ctx, co.MarketID(), ids)
if err != nil {
return err
}
orders = append(orders, ncOrders...)
}
orders = append(orders, ncOrders...)

txHash := entities.TxHash(co.TxHash())
for _, o := range orders {
o.Status = entities.OrderStatusCancelled
Expand Down

0 comments on commit f3d2d75

Please sign in to comment.