Skip to content

Commit

Permalink
fix: incorrect handling of delete object (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
forcodedancing authored Feb 1, 2024
1 parent 8bd1c78 commit 38774f6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions monitor/gnfd_block_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@ func (p *GnfdBlockProcessor) Process(blockHeight uint64) error {
util.Logger.Errorf("processor: %s, fail to handle EventDeleteObject err: %s", p.Name(), err)
return err
}
if rawSql != "" {
rawDeleteSqls = append(rawDeleteSqls, rawSqls...)
}
rawDeleteSqls = append(rawDeleteSqls, rawSqls...)

}
}

Expand Down Expand Up @@ -336,10 +335,14 @@ func (p *GnfdBlockProcessor) handleEventDeleteObject(blockHeight uint64, event a

objectId := deleteObject.ObjectId.Uint64()
item, err := p.itemDao.GetByObjectId(context.Background(), int64(objectId), true)
if err != nil && err != gorm.ErrRecordNotFound {
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
return sqls, err
}

if err != nil && errors.Is(err, gorm.ErrRecordNotFound) {
return sqls, nil
}

rawSql1 := fmt.Sprintf("delete from item_stats where item_id = %d ", item.Id)
sqls = append(sqls, rawSql1)

Expand Down

0 comments on commit 38774f6

Please sign in to comment.