Skip to content

Latest commit

 

History

History
32 lines (24 loc) · 549 Bytes

README.md

File metadata and controls

32 lines (24 loc) · 549 Bytes

Gokiq

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

Usage

import (
  "github.com/duosrx/gokiq"
  "github.com/gomodule/redigo/redis"
  "time"
)

// 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...
job.Enqueue(pool)

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