-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: add listing table to fix monitor interval mismatch between bsc and gnfd #23
Conversation
monitor/gnfd_block_processor.go
Outdated
@@ -230,6 +232,14 @@ func (p *GnfdBlockProcessor) handleEventCreateGroup(blockHeight uint64, event ab | |||
return rawSql, err | |||
} | |||
|
|||
listing, err := p.listingDao.GetByGroupId(context.Background(), int64(createGroup.GroupId.Uint64())) | |||
if err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check whether listing
is nil or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
@@ -230,6 +232,14 @@ func (p *GnfdBlockProcessor) handleEventCreateGroup(blockHeight uint64, event ab | |||
return rawSql, err | |||
} | |||
|
|||
listing, err := p.listingDao.GetByGroupId(context.Background(), int64(createGroup.GroupId.Uint64())) | |||
if err == nil { | |||
return fmt.Sprintf("insert into items (category_id, group_id, group_name, name, owner_address, status, description, url, listed_at, created_gnfd_height, price)"+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set price as well here
@@ -51,7 +51,7 @@ func configureAPI(api *operations.MindMarketplaceAPI) http.Handler { | |||
|
|||
go func() { | |||
http.Handle("/metrics", promhttp.Handler()) | |||
util.Logger.Fatal(http.ListenAndServe(":9292", nil)) | |||
util.Logger.Fatal(http.ListenAndServe(":9293", nil)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not commit this change, it will affect the metrics in testnet/mainnet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
dao/listing.go
Outdated
|
||
func (dao *DbListingDao) GetByGroupId(context context.Context, groupId int64) (database.Listing, error) { | ||
var item = database.Listing{} | ||
if err := dao.db.Preload("Stats").Where("group_id = ?", groupId).Take(&item).Error; err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Listing has no Stats
field. No preload is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
database/listing.go
Outdated
type Listing struct { | ||
Id int64 `json:"id" gorm:"primaryKey"` | ||
Price decimal.Decimal `json:"price" gorm:"type:decimal(65,0);"` | ||
ListBscHeight uint64 `gorm:"NOT NULL;index:idx_list_bsc_height"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove index:idx_list_bsc_height
this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
dao/listing.go
Outdated
} | ||
|
||
func (dao *DbListingDao) GetByGroupId(context context.Context, groupId int64) (database.Listing, error) { | ||
var item = database.Listing{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename item
to listing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed
Description
add listing table to fix monitor interval mismatch between bsc and gnfd