Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegistryMatchPattern ¶
func RegistryMatchPattern() string
Types ¶
type Config ¶
type Config struct {
Database DatabaseConfig `yaml:"database"`
Concurrency int `yaml:"concurrency"`
BRPopTimeout config.Duration `yaml:"brpop_timeout"`
QueueStrategy QueueStrategy `yaml:"queue_strategy"`
RetryBackoffBase config.Duration `yaml:"retry_backoff_base"`
RetryBackoffMax config.Duration `yaml:"retry_backoff_max"`
OutcomeWriteTimeout config.Duration `yaml:"outcome_write_timeout"`
ShutdownGrace config.Duration `yaml:"shutdown_grace"`
HeartbeatInterval config.Duration `yaml:"heartbeat_interval"`
StaleMultiplier int `yaml:"stale_multiplier"`
RegistryInterval config.Duration `yaml:"registry_interval"`
RegistryTTL config.Duration `yaml:"registry_ttl"`
LogFlushInterval config.Duration `yaml:"log_flush_interval"`
LogFlushTimeout config.Duration `yaml:"log_flush_timeout"`
LogFlushThreshold int `yaml:"log_flush_threshold"`
LogBufferCapacity int `yaml:"log_buffer_capacity"`
}
func LoadConfig ¶
An empty path means the embedded defaults, so an importing application can start a worker without vendoring a copy of worker.yaml and re-vendoring it every time a key is added. The defaults go through validate() like any file would.
func (Config) StaleDelta ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
Partitioning PartitioningConfig `yaml:"partitioning"`
Retention RetentionConfig `yaml:"retention"`
}
type InflightJob ¶
type PartitionInterval ¶
type PartitionInterval string
const ( PartitionWeekly PartitionInterval = "weekly" PartitionMonthly PartitionInterval = "monthly" PartitionQuarterly PartitionInterval = "quarterly" PartitionHalfYearly PartitionInterval = "half_yearly" PartitionYearly PartitionInterval = "yearly" )
func (PartitionInterval) Valid ¶
func (p PartitionInterval) Valid() bool
type PartitioningConfig ¶
type PartitioningConfig struct {
Interval PartitionInterval `yaml:"interval"`
CreateAhead int `yaml:"create_ahead"`
}
type QueueStrategy ¶
type QueueStrategy string
const ( QueueStrategyPriority QueueStrategy = "priority" QueueStrategyRoundRobin QueueStrategy = "round_robin" )
func (QueueStrategy) Valid ¶
func (q QueueStrategy) Valid() bool
type RegistryEntry ¶
type RetentionConfig ¶
type RetentionConfig struct {
Days int `yaml:"days"`
}
type WorkerService ¶
type WorkerService struct {
// contains filtered or unexported fields
}
func NewWorkerService ¶
func NewWorkerService(jobRepo *job.Repository, rdb *redis.Client, log *slog.Logger, cfg Config, name string, queues []string, concurrency int, handlers map[string]HandlerFunc) *WorkerService
func (*WorkerService) PopAndDispatchJobs ¶
func (w *WorkerService) PopAndDispatchJobs(ctx context.Context) error
Click to show internal directories.
Click to hide internal directories.