locker

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrQueueExists = errors.New("queue exists")

ErrQueueExists shows this queue is already registered.

Functions

This section is empty.

Types

type QueueLocker

type QueueLocker interface {
	Lock(ctx context.Context, key string) error
	Unlock(ctx context.Context, before time.Time) error
}

QueueLocker represents locker interface for suppressing queue duplication.

type Unlocker

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

Unlocker removes unused queue_id list periodically.

func NewUnlocker

func NewUnlocker(l QueueLocker, interval time.Duration, opts ...UnlockerOption) (*Unlocker, error)

NewUnlocker creates Unlocker. As default, expire duration is 24 hours.

func (Unlocker) Run

func (u Unlocker) Run(ctx context.Context)

Run runs unlock operation by interval.

type UnlockerOption

type UnlockerOption func(*Unlocker)

UnlockerOption is an option for Unlocker.

func ExpireDuration

func ExpireDuration(dur time.Duration) UnlockerOption

ExpireDuration sets expire duration to Unlocker.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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