-
Notifications
You must be signed in to change notification settings - Fork 3
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
fix: query failure_reason = "" #16
Conversation
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.
LGTM
36c2a78
to
e31ae56
Compare
@@ -93,7 +93,7 @@ func ProcessUnprovenBotDelegatedWithdrawals(ctx context.Context, log log.Logger, | |||
maxBlockTime := time.Now().Unix() - cfg.Misc.ProposeTimeWindow | |||
|
|||
unprovens := make([]core.L2ContractEvent, 0) | |||
result := db.Order("id asc").Where("proven = false AND block_time < ? AND failure_reason IS NULL", maxBlockTime).Limit(limit).Find(&unprovens) | |||
result := db.Order("id asc").Where("proven = false AND block_time < ? AND failure_reason = ''", maxBlockTime).Limit(limit).Find(&unprovens) |
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.
Why do this change? Seems the schema still allows NULL.
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.
This is related to the Go type definition. The failure reason is defined as a Go string instead of a string. That makes L2ContractEvent.FailureReason
default to be empty string ""
but not nil
. Due to this, the failure reason inserted is ""
not NULL
.
type L2ContractEvent struct {
...
FailureReason string `gorm:"type:text"`
}
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.
I am gonna close this PR and fix this issue by changing L2ContractEvent.FailureReason
to *string
.
e31ae56
to
5908c6b
Compare
I am gonna close this PR and fix this issue by changing |
When comparing if a ‘text’ type database field is empty, use
= '
' instead ofIS NULL
.