This commit is contained in:
@@ -2,6 +2,7 @@ package polling
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"math"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -79,7 +80,7 @@ func (s *ConcurrencyService) List(ctx context.Context) ([]*ConcurrencyStatus, er
|
|||||||
status.Available = 0
|
status.Available = 0
|
||||||
}
|
}
|
||||||
if cfg.MaxConcurrency > 0 {
|
if cfg.MaxConcurrency > 0 {
|
||||||
status.Utilization = float64(current) / float64(cfg.MaxConcurrency) * 100
|
status.Utilization = math.Round(float64(current)/float64(cfg.MaxConcurrency)*1000000) / 100
|
||||||
}
|
}
|
||||||
|
|
||||||
result = append(result, status)
|
result = append(result, status)
|
||||||
@@ -117,7 +118,7 @@ func (s *ConcurrencyService) GetByTaskType(ctx context.Context, taskType string)
|
|||||||
status.Available = 0
|
status.Available = 0
|
||||||
}
|
}
|
||||||
if cfg.MaxConcurrency > 0 {
|
if cfg.MaxConcurrency > 0 {
|
||||||
status.Utilization = float64(current) / float64(cfg.MaxConcurrency) * 100
|
status.Utilization = math.Round(float64(current)/float64(cfg.MaxConcurrency)*1000000) / 100
|
||||||
}
|
}
|
||||||
|
|
||||||
return status, nil
|
return status, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user