Skip to content

Commit

Permalink
Make sure we're not timing the mist balancer call (#1398)
Browse files Browse the repository at this point in the history
mjh1 authored Jan 22, 2025
1 parent 49a535f commit dd00f1e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion balancer/balancer.go
Original file line number Diff line number Diff line change
@@ -70,8 +70,8 @@ func (c CombinedBalancer) UpdateMembers(ctx context.Context, members []cluster.M
}

func (c CombinedBalancer) GetBestNode(ctx context.Context, redirectPrefixes []string, playbackID, lat, lon, fallbackPrefix string, isStudioReq bool) (string, string, error) {
start := time.Now()
if c.CatabalancerPlaybackEnabled {
start := time.Now()
node, fullPlaybackID, err := c.Catabalancer.GetBestNode(ctx, redirectPrefixes, playbackID, lat, lon, fallbackPrefix, isStudioReq)
metrics.Metrics.CatabalancerRequestDurationSec.
WithLabelValues(strconv.FormatBool(err == nil), "playback", "", "false").
@@ -81,6 +81,7 @@ func (c CombinedBalancer) GetBestNode(ctx context.Context, redirectPrefixes []st

bestNode, fullPlaybackID, err := c.MistBalancer.GetBestNode(ctx, redirectPrefixes, playbackID, lat, lon, fallbackPrefix, isStudioReq)
go func() {
start := time.Now()
cataBestNode, cataFullPlaybackID, cataErr := c.Catabalancer.GetBestNode(ctx, redirectPrefixes, playbackID, lat, lon, fallbackPrefix, isStudioReq)
log.LogNoRequestID("catabalancer GetBestNode",
"bestNode", bestNode,

0 comments on commit dd00f1e

Please sign in to comment.