Documentation
¶
Overview ¶
Package queue provides a simple queue implementation with support for deduping equivalent jobs using the notion of a unique key for each job.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue implements the queue.
func (*Queue) Dequeue ¶
Dequeue removes any waiting job having the supplied key. Running jobs are not affected.
func (*Queue) Enqueue ¶
Enqueue enqueues a job with a specific key. The job will not be added to the queue if there already exists a job that is waiting to be processed which has the same key. Note that a running job for the same key will still cause this one to be enqueued.
func (*Queue) Start ¶
Start starts the background processing for the queue. Processing stops when the context is canceled.
func (*Queue) WaitForKey ¶
WaitForKey waits until the running and waiting jobs for this key have completed. Note that it will not wait forever even the queue keeps getting new job with the same key after this function is called.