func (job *IncomingJob) RetryDelay() uint {
	return job.RetryDelayField
}
RetryDelay returns the delay for retries of the job.
package web
import (
	"encoding/json"
	"errors"
	"net/http"
	"github.com/gorilla/mux"
)
func (app *Application) serveJob(w http.ResponseWriter, req *http.Request) error {
	if req.Method != "POST" {
		return errMethodNotAllowed
	}
	vars := mux.Vars(req)
	var job IncomingJob
	decoder := json.NewDecoder(req.Body)
	decoder.UseNumber()
	if err := decoder.Decode(&job); err != nil {
		return errBadRequest.WithDetail(err.Error())
	}
	if err := job.DecodePayload(); err != nil {
		return errBadRequest.WithDetail(err.Error())
	}
	if job.URLField == "" {
		return errBadRequest.WithDetail("Missing field: url")
	}
	job.CategoryField = vars["category"]
	r, err := app.Service.Push(&job)
	if err != nil {
		return err
	}
	result := PushResult{r.ID, r.QueueName, job}
	j, err := json.Marshal(&result)
	if err != nil {
		return err
	}
	writeJSON(w, j)
	return nil
}
type IncomingJob struct {
	CategoryField string          `json:"category"`
	URLField      string          `json:"url"`
	PayloadField  json.RawMessage `json:"payload"`
	payloadField  string
	RunAfterField   uint `json:"run_after"`    
	TimeoutField    uint `json:"timeout"`      
	RetryDelayField uint `json:"retry_delay"`  
	MaxRetriesField uint `json:"max_retries"`
}
type PushResult struct {
	ID        uint64 `json:"id"`
	QueueName string `json:"queue_name"`
	IncomingJob
}
func (job *IncomingJob) Category() string {
	return job.CategoryField
}
func (job *IncomingJob) URL() string {
	return job.URLField
}
func (job *IncomingJob) DecodePayload() error {
	payload := job.PayloadField
	if len(payload) > 0 && payload[0] == '"' && payload[len(payload)-1] == '"' {
		var buf string
		err := json.Unmarshal(payload, &buf)
		if err != nil {
			return errors.New("The payload seems to be a string but is broken")
		}
		job.payloadField = buf
	} else if len(payload) == 4 && payload[0] == 'n' && payload[1] == 'u' && payload[2] == 'l' && payload[3] == 'l' {
		job.payloadField = ""
	} else {
		job.payloadField = string(payload)
	}
	return nil
}
func (job *IncomingJob) Payload() string {
	if job.payloadField == "" {
		job.DecodePayload()
	}
	return job.payloadField
}
func (job *IncomingJob) NextDelay() uint64 {
	return uint64(job.RunAfterField * 1000)
}
func (job *IncomingJob) RetryCount() uint {
	return job.MaxRetriesField
}