Skip to content

Commit

Permalink
kruto
Browse files Browse the repository at this point in the history
  • Loading branch information
Satont committed Jun 10, 2024
1 parent e78efe9 commit 8a74f75
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"time"

"github.com/goccy/go-json"
"github.com/redis/go-redis/v9"
Expand Down Expand Up @@ -125,7 +126,7 @@ func (c *NowPlayingFetcher) Fetch(ctx context.Context) (*Track, error) {

if track != nil && !track.fromCache {
redisKey := fmt.Sprintf("overlays:nowplaying:%s", c.channelId)
if err := c.redis.Set(ctx, redisKey, track, 0).Err(); err != nil {
if err := c.redis.Set(ctx, redisKey, track, 10*time.Second).Err(); err != nil {
return nil, err
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,12 @@ func (r *subscriptionResolver) nowPlayingCurrentTrackSubscription(
track, err := npService.Fetch(ctx)
if err != nil {
r.logger.Error("failed to get now playing track", slog.Any("err", err))
time.Sleep(10 * time.Second)
time.Sleep(5 * time.Second)
continue
}

if track == nil {
time.Sleep(5 * time.Second)
continue
}

Expand All @@ -606,7 +611,7 @@ func (r *subscriptionResolver) nowPlayingCurrentTrackSubscription(
ImageURL: imageUrl,
}

time.Sleep(10 * time.Second)
time.Sleep(5 * time.Second)
}
}
}()
Expand Down
2 changes: 0 additions & 2 deletions apps/websockets/internal/grpc_impl/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ func (c *GrpcImpl) RefreshOverlaySettings(
err = c.beRightBackServer.SendSettings(req.GetChannelId())
case websockets.RefreshOverlaySettingsName_DUDES:
err = c.dudesServer.SendSettings(req.GetChannelId(), req.GetOverlayId())
case websockets.RefreshOverlaySettingsName_NOW_PLAYING:
err = c.nowplayingServer.SendSettings(req.GetChannelId(), req.GetOverlayId())
default:
return nil, fmt.Errorf("unknown overlay: %s", req.GetOverlayName())
}
Expand Down

0 comments on commit 8a74f75

Please sign in to comment.