Browse Source

Adds some clarification to docs

Noah Pederson 1 year ago
2 changed files with 17 additions and 4 deletions
  1. +12
  2. +5

+ 12
- 4
job.go View File

@ -19,11 +19,19 @@ const (
//Job wraps arbitrary data for processing
type Job struct {
Status JobStatus
ID uint64
Data []byte
Status JobStatus
//Unique identifier for a Job
ID uint64
//Data contains the bytes that were pushed using Queue.PushBytes()
Data []byte
//RetryCount is the number of times the job has been retried
//If your work can have a temporary failure state, it is recommended
//that you check retry count and return a fatal error after a certain
//number of retries
RetryCount int
Message string
//Message is primarily used for debugging. It conatains status info
//about what was last done with the job.
Message string
//DecodeJob decodes a gob encoded byte array into a Job struct and returns a pointer to it

+ 5
- 0
worker.go View File

@ -4,6 +4,11 @@ import "context"
//Worker represents a worker for handling Jobs
type Worker interface {
//DoWork is called when a worker picks up a job from the queue
//Context can be used for cancelling jobs early when Close
//is called on the Queue
DoWork(context.Context, *Job) error
//ID is a semi-unique identifier for a worker
//it is primarily used for logging purposes
ID() string