package module
Version: v0.0.0-...-23d51ee Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 6 Imported by: 0


Gokiq Build Status

Gokiq is a small library to easily enqueue Sidekiq jobs from Go.


import (

// Create a Redis Pool first
var pool = &redis.Pool{
	MaxIdle:     3,
	IdleTimeout: 240 * time.Second,
	Dial: func() (redis.Conn, error) {
		return redis.Dial("tcp", ":6379")

job := NewJob("HardWorker", "default", []string{"foo", "bar"})

// Enqueue immediately...

// ... or enqueue in the future
now := time.Now()
job.EnqueueAt(now, pool)




This section is empty.


This section is empty.


This section is empty.


type Job

type Job struct {
	JID        string        `json:"jid"`
	Retry      int           `json:"retry"`
	Queue      string        `json:"queue"`
	Class      string        `json:"class"`
	Args       []interface{} `json:"args"`
	EnqueuedAt int64         `json:"enqueued_at"`

Job holds all the information about the job to be enqueued.

func NewJob

func NewJob(class, queue string, args []interface{}, retry int) *Job

NewJob initialize a new job given a class, queue and arguments.

func (*Job) Enqueue

func (job *Job) Enqueue(pool *redis.Pool) error

Enqueue inserts the job into the Sidekiq queue instantly.

func (*Job) EnqueueAt

func (job *Job) EnqueueAt(time time.Time, pool *redis.Pool) error

EnqueueAt insert the job into the Sidekiq scheduled queue at the given time.

func (*Job) EnqueueIn

func (job *Job) EnqueueIn(duration time.Duration, pool *redis.Pool) error

EnqueueIn insert the job into the queue after the given duration.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL