|
@@ -180,10 +180,6 @@ func (c *ByClassifier) enroll() {
|
|
|
|
|
|
func sortMap(unsorted *sync.Map, size int) {
|
|
|
|
|
|
- if size == 0 {
|
|
|
- size = 1
|
|
|
- }
|
|
|
-
|
|
|
type Myt struct {
|
|
|
Name string
|
|
|
Num int64
|
|
@@ -201,7 +197,7 @@ func sortMap(unsorted *sync.Map, size int) {
|
|
|
|
|
|
sort.Slice(tempCont, func(i, j int) bool { return tempCont[i].Num > tempCont[j].Num })
|
|
|
|
|
|
- if len(tempCont) > size {
|
|
|
+ if len(tempCont) > size && size > 0 {
|
|
|
tempCont = tempCont[:size]
|
|
|
}
|
|
|
|