🐛 Fix infinite loading

This commit is contained in:
LittleSheep 2024-12-29 00:15:59 +08:00
parent 3a00a06541
commit 9f0bce81ce
2 changed files with 4 additions and 4 deletions

View File

@ -6,6 +6,7 @@ import (
"git.solsynth.dev/hypernet/paperclip/pkg/internal/models" "git.solsynth.dev/hypernet/paperclip/pkg/internal/models"
jsoniter "github.com/json-iterator/go" jsoniter "github.com/json-iterator/go"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/spf13/cast"
"github.com/spf13/viper" "github.com/spf13/viper"
) )
@ -20,8 +21,9 @@ var (
) )
func BuildDestinationMapping() { func BuildDestinationMapping() {
count := len(viper.GetStringSlice("destinations")) count := len(cast.ToSlice(viper.Get("destinations")))
for idx := 0; idx < count; idx++ { for idx := 0; idx < count; idx++ {
fmt.Println(idx)
destMap := viper.GetStringMap(fmt.Sprintf("destinations.%d", idx)) destMap := viper.GetStringMap(fmt.Sprintf("destinations.%d", idx))
var parsed models.BaseDestination var parsed models.BaseDestination
raw, _ := jsoniter.Marshal(destMap) raw, _ := jsoniter.Marshal(destMap)
@ -36,8 +38,6 @@ func BuildDestinationMapping() {
DestinationsByIndex[idx] = mapping DestinationsByIndex[idx] = mapping
DestinationsByRegion[parsed.Region] = mapping DestinationsByRegion[parsed.Region] = mapping
} }
count++
} }
log.Info().Int("count", count).Msg("Destinations mapping built") log.Info().Int("count", count).Msg("Destinations mapping built")

View File

@ -10,7 +10,7 @@ files_deletion = 4
files_analyze = 4 files_analyze = 4
[debug] [debug]
database = true database = false
print_routes = false print_routes = false
[performance] [performance]