Documentation
¶
Overview ¶
Package pgqueue provides a Postgres-backed queue implementation for scheduling and processing fetch actions. It supports multiple concurrent workers (processes or goroutines)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProcessFunc ¶
ProcessFunc is the function signature for processing dequeued work.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue implements the Queue interface backed by a Postgres table. It is safe for concurrent use by multiple goroutines and processes.
func (*Queue) Poll ¶
func (q *Queue) Poll(ctx context.Context, workers int, processFunc ProcessFunc)
Poll starts background polling for work. It spawns the given number of worker goroutines, each of which periodically claims a task, runs processFunc, and deletes the task on completion. It blocks until ctx is cancelled.
Click to show internal directories.
Click to hide internal directories.