Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/jimyj/go-queue

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/jimyj/go-queue

  • v0.0.0-20181207032948-9a12824f7383
  • Source
  • Go
  • Socket score

Version published
Created
Source

Build Status Go Report Card

go-queue

go-queue is task queue for concurrency(go-queue 是一个通用的并发通道,可以自定义同时并发数和自定义并发任务)

How to get

go get github.com/JimYJ/go-queue

Usage

import:

import "github.com/JimYJ/go-queue"

init and use:

func main() {
	queue.Debug() // show log
    queue.InitQueue(2, true, true)                    // frist param means max concurrent.
                                                      // if second param is true,means main goroutine will wait that all queue done. 
                                                      // if third param is true, means every error or timeout will retry 3 times.
	queue.SetConcurrentInterval(1 * time.Millisecond) // set interval time for each concurrent, default 0
	for i := 0; i < 10; i++ {
		job := new(queue.Job)
		job.ID = int64(i)
		job.FuncQueue = youfunc
		job.Payload = []interface{}{100, 50}
		queue.Push(job)
	}
	queue.Done()
	log.Println(queue.FailList)
}

func youfunc(value ...interface{}) error { //you func must meet type Func func(value ...interface{})error
	//dosomething
	return errors.New("error info")
}

FAQs

Package last updated on 07 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc