Skip to content

Commit

Permalink
use total count only on logs
Browse files Browse the repository at this point in the history
  • Loading branch information
sonroyaalmerol committed Dec 22, 2024
1 parent e658d72 commit 19584b9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions store/concurrency.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,20 @@ func (cm *ConcurrencyManager) CheckConcurrency(m3uIndex string) bool {
}

func (cm *ConcurrencyManager) UpdateConcurrency(m3uIndex string, subIndex string, incr bool) {
cm.mu.Lock()
defer cm.mu.Unlock()

if incr {
cm.Increment(m3uIndex, subIndex)
} else {
cm.Decrement(m3uIndex, subIndex)
}

count := cm.GetCount(m3uIndex, subIndex)
utils.SafeLogf("Current number of connections for M3U_%s|%s: %d", m3uIndex, subIndex, count)
totalCount := 0
for subIndex := range cm.count[m3uIndex] {
count := cm.GetCount(m3uIndex, subIndex)
totalCount += count
}

utils.SafeLogf("Current number of connections for M3U_%s: %d", m3uIndex, totalCount)
}

0 comments on commit 19584b9

Please sign in to comment.