Skip to content

LyricTian/queue

Repository files navigation

queue

A task queue for mitigating server pressure in high concurrency situations and improving task processing.

Build Codecov ReportCard GoDoc License

Get

go get -u -v github.com/LyricTian/queue

Usage

package main

import (
	"fmt"

	"github.com/LyricTian/queue"
)

func main() {
	q := queue.NewQueue(10, 100)
	q.Run()

	defer q.Terminate()

	job := queue.NewJob("hello", func(v interface{}) {
		fmt.Printf("%s,world \n", v)
	})
	q.Push(job)

	// output: hello,world
}

MIT License

    Copyright (c) 2017 Lyric