diff --git a/apps/api/internal/impl_unprotected/stats/stats.go b/apps/api/internal/impl_unprotected/stats/stats.go index e4a08ddcd..b7cad8164 100644 --- a/apps/api/internal/impl_unprotected/stats/stats.go +++ b/apps/api/internal/impl_unprotected/stats/stats.go @@ -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( diff --git a/libs/twitch/twitch.go b/libs/twitch/twitch.go index 422977d73..66bdff9fb 100644 --- a/libs/twitch/twitch.go +++ b/libs/twitch/twitch.go @@ -2,6 +2,7 @@ package twitch import ( "context" + "fmt" "time" cfg "github.com/satont/twir/libs/config" @@ -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, @@ -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