Help us shape the future of Go! Take the 2026 Go Developer Survey

subscription

package
v1.21.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package subscription holds the queue handlers of the scheduled subscription tasks: the lifecycle sweep and the pre-expiry reminder. The business rules live in the subscription module; the handlers only run it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckSubscriptionHandler added in v1.21.0

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

CheckSubscriptionHandler is the queue shell of the subscription lifecycle sweep. The sweep runs every minute and notifies the owners of the subscriptions it finishes, so a run that outlasts the tick must not overlap the next one: both would select the same rows and the owners would hear twice. The lock keeps the runs apart; a failed run returns its error and asynq retries it.

func NewCheckSubscriptionHandler added in v1.21.0

func NewCheckSubscriptionHandler(sweeper LifecycleSweeper, rdb *redis.Client) *CheckSubscriptionHandler

NewCheckSubscriptionHandler builds the shell over the subscription facade and the Redis connection holding the run lock.

func (*CheckSubscriptionHandler) ProcessTask added in v1.21.0

func (h *CheckSubscriptionHandler) ProcessTask(ctx context.Context, _ *asynq.Task) error

type LifecycleSweeper added in v1.21.0

type LifecycleSweeper interface {
	CheckSubscriptions(ctx context.Context) error
}

LifecycleSweeper is the subscription module's lifecycle sweep.

type RemindExpiringHandler added in v1.21.0

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

RemindExpiringHandler is the queue shell of the pre-expiry reminder.

func NewRemindExpiringHandler added in v1.21.0

func NewRemindExpiringHandler(service module.Service) *RemindExpiringHandler

NewRemindExpiringHandler builds the shell over the subscription facade.

func (*RemindExpiringHandler) ProcessTask added in v1.21.0

func (h *RemindExpiringHandler) ProcessTask(ctx context.Context, _ *asynq.Task) error

Jump to

Keyboard shortcuts

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