gotime

package
v0.0.0-...-5fb48e9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultStore

type DefaultStore struct {
	// contains filtered or unexported fields
}

DefaultStore is a default implementation of the Store interface.

func NewStore

func NewStore(rc *redis.Client) (*DefaultStore, error)

NewStore returns a new DefaultStore.

func (*DefaultStore) Get

func (s *DefaultStore) Get(ctx context.Context) (int64, bool, error)

Get satisfies Store.

func (*DefaultStore) Put

func (s *DefaultStore) Put(ctx context.Context, id int64) error

Put satisfies Store.

type GoTime

type GoTime struct {
	// contains filtered or unexported fields
}

GoTime tracks when it's Go Time!

func New

func New(s Store, c *http.Client, logger zerolog.Logger, startTimeVariance time.Duration, notify NotifyFunc) (*GoTime, error)

New constructs a *GoTime.

startTimeVariance sets the window around the stream's start time when a live steam will be considered a GoTime live stream. This is necessary because the current changelog APIs return whether any show is streaming rather thahn GoTime specifically.

notify is called when streaming starts. notify should return true when a successful.

func (*GoTime) Poll

func (gt *GoTime) Poll(ctx context.Context) error

Poll conditionally calls notify if GoTime is currently streaming.

For a notification to be posted: a notification must not have been successful in the last 24 hours, changelog is currently streaming, and there is a GoTime episode scheduled within +/-startTimeVariance.

type NotifyFunc

type NotifyFunc func(context.Context) error

NotifyFunc represents the function signature the poller notifies on a new item. If error is not nil, the item will be retried at some point in the future.

type Store

type Store interface {
	Get(ctx context.Context) (id int64, notFound bool, err error)
	Put(ctx context.Context, lastID int64) error
}

Store represents the shape of the storage system.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL