Skip to content

Commit d332a6d

Browse files
authored
refactor: use the built-in max/min to simplify the code (#5192)
Signed-off-by: todaymoon <[email protected]>
1 parent af98279 commit d332a6d

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

core/ledger/kvledger/txmgmt/statedb/statecouchdb/metadata_retrieval.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func retrieveNsMetadata(db *couchDatabase, keys []string) ([]*docMetadata, error
5757
batches := []batch{}
5858
remainingKeys := keys
5959
for {
60-
numKeys := minimum(maxBatchSize, len(remainingKeys))
60+
numKeys := min(maxBatchSize, len(remainingKeys))
6161
if numKeys == 0 {
6262
break
6363
}
@@ -99,10 +99,3 @@ func (b *subNsMetadataRetriever) execute() error {
9999
func (b *subNsMetadataRetriever) String() string {
100100
return fmt.Sprintf("subNsMetadataRetriever:ns=%s, num keys=%d", b.ns, len(b.keys))
101101
}
102-
103-
func minimum(a, b int) int {
104-
if a < b {
105-
return a
106-
}
107-
return b
108-
}

0 commit comments

Comments
 (0)