fix: GetRandomSatisfiedChannel

This commit is contained in:
CaIon 2024-04-04 19:37:33 +08:00
parent c040fa229d
commit aaf3a1f07b
2 changed files with 2 additions and 2 deletions

View File

@ -111,7 +111,7 @@ var IsMasterNode = os.Getenv("NODE_TYPE") != "slave"
var requestInterval, _ = strconv.Atoi(os.Getenv("POLLING_INTERVAL")) var requestInterval, _ = strconv.Atoi(os.Getenv("POLLING_INTERVAL"))
var RequestInterval = time.Duration(requestInterval) * time.Second var RequestInterval = time.Duration(requestInterval) * time.Second
var SyncFrequency = GetOrDefault("SYNC_FREQUENCY", 10*60) // unit is second var SyncFrequency = GetOrDefault("SYNC_FREQUENCY", 60) // unit is second
var BatchUpdateEnabled = false var BatchUpdateEnabled = false
var BatchUpdateInterval = GetOrDefault("BATCH_UPDATE_INTERVAL", 5) var BatchUpdateInterval = GetOrDefault("BATCH_UPDATE_INTERVAL", 5)

View File

@ -57,7 +57,7 @@ func GetRandomSatisfiedChannel(group string, model string) (*Channel, error) {
// Randomly choose one // Randomly choose one
weight := common.GetRandomInt(int(weightSum)) weight := common.GetRandomInt(int(weightSum))
for _, ability_ := range abilities { for _, ability_ := range abilities {
weight -= int(ability_.Weight) weight -= int(ability_.Weight) + 10
//log.Printf("weight: %d, ability weight: %d", weight, *ability_.Weight) //log.Printf("weight: %d, ability weight: %d", weight, *ability_.Weight)
if weight <= 0 { if weight <= 0 {
channel.Id = ability_.ChannelId channel.Id = ability_.ChannelId