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

github.com/moeyang/go-queue

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/moeyang/go-queue

  • v0.0.0-20210407055646-c5a229ee466c
  • Source
  • Go
  • Socket score

Version published
Created
Source

delayqueue

A Multi-safe Delay queue by Golang.

How To Use
type Task struct {
	ID int
}

// create a delay queue with cap 3
q := NewDelayQueue(3)
// add a Task to queue which should run after 10 seconds later
q.Offer(Task{ID: 1}, time.Now().Add(10*time.Second))

// run a goroutine to deal timer check
go q.Poll()

// get ready element from delay queue
ele := <-q.C
fmt.Println(ele) // Task{ID: 1}

// stop go q.Poll(), you can run queue by call q.Poll() then.
q.Stop()

FAQs

Package last updated on 07 Apr 2021

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