-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
refactor!: code optimization as stricter linters are in place #188
Conversation
internal/service/scheduler/snapshot/operation_pool/operation_pool.go
Outdated
Show resolved
Hide resolved
} | ||
|
||
// should not include genesis account | ||
if nodeInfo.Account == ethereum.AddressGenesis { |
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 not sure why we should check AddressGenesis
here?
@@ -24,7 +25,7 @@ import ( | |||
"go.uber.org/zap" | |||
) | |||
|
|||
var ( | |||
var ( // FIXME: Name should be "operation_pool", update the file naem too. |
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 keeping the file name unchanged so we can have a diff view. It eventually needs to be changed.
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.
Same for the db table name, search for // FIXME
if nodeInfo.Account == ethereum.AddressGenesis { | ||
return nil | ||
} | ||
|
||
mutex.Lock() | ||
defer mutex.Unlock() |
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 do not think mutex
is required here, we can just use the range index to avoid race conditions.
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (s *server) getNodesFromDB(ctx context.Context) ([]*schema.Node, error) { | ||
nodes, err := s.databaseClient.FindNodes(ctx, schema.FindNodesQuery{}) |
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.
when the number of nodes increases, lacking paginations will cause problems.
make dev miserable again