Skip to content

Commit

Permalink
chore(api): adjust deadline time for streamers stats
Browse files Browse the repository at this point in the history
  • Loading branch information
Satont committed Aug 7, 2024
1 parent 1e1a2d5 commit 68eeaa0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/api/internal/impl_unprotected/stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (c *Stats) cacheStreamers() {
func() {
userTwitchClientCtx, userTwitchClientCtxCancel := context.WithTimeout(
context.Background(),
5*time.Second,
60*time.Second,
)
defer userTwitchClientCtxCancel()
userTwitchClient, err := twitch.NewUserClientWithContext(
Expand Down
8 changes: 5 additions & 3 deletions libs/twitch/twitch.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package twitch

import (
"context"
"fmt"
"time"

cfg "github.com/satont/twir/libs/config"
Expand Down Expand Up @@ -91,11 +92,12 @@ func NewUserClientWithContext(
grpc.WaitForReady(true),
)
if err != nil {
return nil, err
return nil, fmt.Errorf("cannot request user token from tokens service: %w", err)
}

client, err := helix.NewClientWithContext(
ctx, &helix.Options{
ctx,
&helix.Options{
ClientID: config.TwitchClientId,
ClientSecret: config.TwitchClientSecret,
RedirectURI: config.TwitchCallbackUrl,
Expand All @@ -104,7 +106,7 @@ func NewUserClientWithContext(
},
)
if err != nil {
return nil, err
return nil, fmt.Errorf("cannot create helix client: %w", err)
}

return client, nil
Expand Down

0 comments on commit 68eeaa0

Please sign in to comment.