Documentation
¶
Index ¶
- type BatchCompleter
- func (bc *BatchCompleter) Complete(taskID, generation int64) error
- func (bc *BatchCompleter) Fail(taskID, generation int64, message string) error
- func (bc *BatchCompleter) Retry(taskID, generation int64, blockedTill time.Time, message string) error
- func (bc *BatchCompleter) Snooze(taskID, generation int64, blockedTill time.Time) error
- func (bc *BatchCompleter) Start(ctx context.Context) error
- func (bc *BatchCompleter) Stop()
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchCompleter ¶
type BatchCompleter struct {
// contains filtered or unexported fields
}
BatchCompleter accumulates task state transitions and flushes them to PostgreSQL in batches. The same task claim submitted multiple times across different operations collapses to the last write.
func NewBatchCompleter ¶
func NewBatchCompleter(repo completerRepo, cfg Config) *BatchCompleter
NewBatchCompleter creates a new BatchCompleter.
func (*BatchCompleter) Complete ¶
func (bc *BatchCompleter) Complete(taskID, generation int64) error
Complete marks a task as completed.
func (*BatchCompleter) Fail ¶
func (bc *BatchCompleter) Fail(taskID, generation int64, message string) error
Fail marks a task as failed with an error message.
func (*BatchCompleter) Retry ¶
func (bc *BatchCompleter) Retry(taskID, generation int64, blockedTill time.Time, message string) error
Retry schedules a task for retry.
func (*BatchCompleter) Snooze ¶
func (bc *BatchCompleter) Snooze(taskID, generation int64, blockedTill time.Time) error
Snooze reschedules a task without counting it as an attempt.
func (*BatchCompleter) Start ¶
func (bc *BatchCompleter) Start(ctx context.Context) error
Start begins the batch processing loop. Calling Start twice returns an error.
func (*BatchCompleter) Stop ¶
func (bc *BatchCompleter) Stop()
Stop signals the run loop to exit, waits for the final flush, and returns. Safe to call multiple times and safe to call without Start.