Documentation
¶
Overview ¶
Package completer writes job completions and heartbeats to the database in batches.
Index ¶
Constants ¶
View Source
const ( DefaultBatchSize = 100 DefaultFlushInterval = 50 * time.Millisecond DefaultBufferSize = 10_000 DefaultMaxRetryDelay = 5 * time.Second DefaultFlushTimeout = 10 * time.Second DefaultCallTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Completer ¶
type Completer struct {
// contains filtered or unexported fields
}
Completer batches job completions into single statements and retries them on database errors.
func (*Completer) Add ¶
func (c *Completer) Add(comp job.Completion)
Add queues one completion for the next batch.
type Config ¶
type Config struct {
ClientID string
Store job.CompletionWriter
Clock clock.Clock
Logger *slog.Logger
BatchSize int
FlushInterval time.Duration
BufferSize int
MaxRetryDelay time.Duration
FlushTimeout time.Duration
CallTimeout time.Duration
OnApplied func(applied []job.Completion, stale int)
OnDrained func()
Rand func() float64
}
type HeartbeatConfig ¶
type Heartbeater ¶
type Heartbeater struct {
// contains filtered or unexported fields
}
Heartbeater refreshes the heartbeat of this client's running jobs every Interval.
func NewHeartbeater ¶
func NewHeartbeater(cfg HeartbeatConfig) (*Heartbeater, error)
NewHeartbeater validates cfg and applies defaults.
Click to show internal directories.
Click to hide internal directories.