{"id":23785011,"url":"https://github.com/spy16/delayq","last_synced_at":"2025-07-16T18:05:59.043Z","repository":{"id":57597507,"uuid":"349729344","full_name":"spy16/delayq","owner":"spy16","description":"DelayQ is a Go library that provides a performant, reliable, distributed delay-queue using Redis.","archived":false,"fork":false,"pushed_at":"2024-01-14T21:25:25.000Z","size":55,"stargazers_count":42,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T19:39:02.766Z","etag":null,"topics":["delay-queue","go","golang-library","job-queue","redis","scheduler"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spy16.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-20T13:14:32.000Z","updated_at":"2024-09-15T13:39:42.000Z","dependencies_parsed_at":"2024-06-20T06:57:41.541Z","dependency_job_id":"bc35a1eb-5b95-44b4-9f7e-27e703cb9109","html_url":"https://github.com/spy16/delayq","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/spy16/delayq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spy16%2Fdelayq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spy16%2Fdelayq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spy16%2Fdelayq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spy16%2Fdelayq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spy16","download_url":"https://codeload.github.com/spy16/delayq/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spy16%2Fdelayq/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265529026,"owners_count":23782801,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["delay-queue","go","golang-library","job-queue","redis","scheduler"],"created_at":"2025-01-01T13:13:48.039Z","updated_at":"2025-07-16T18:05:59.020Z","avatar_url":"https://github.com/spy16.png","language":"Go","readme":"# DelayQ\n\n[![GoDoc](https://godoc.org/github.com/spy16/delayq?status.svg)](https://godoc.org/github.com/spy16/delayq) [![Go Report Card](https://goreportcard.com/badge/github.com/spy16/delayq)](https://goreportcard.com/report/github.com/spy16/delayq) ![Go](https://github.com/spy16/delayq/actions/workflows/code_change.yml/badge.svg)\n\nDelayQ is a Go library that provides job-queue (time-constrained) primitives.\n\nCurrently following implementations are supported:\n\n1. `inmem.DelayQ`: An in-memory queue using modified min-heap for time-constrained dequeue.\n2. `redis.DelayQ`: A production-tested queue using Redis (supports both single-node \u0026 cluster) that uses sorted-sets.\n3. `sql.DelayQ`: An implementation backed by any SQL database.\n\n## Features\n\n* Simple - More like a queue primitive to build job-queue instead of being a feature-rich job-queue system.\n* Distributed (with `redis` or `sqldb`) - Multiple producer/consumer processes connect to a Redis node or cluster.\n* Reliable - `at-least-once` semantics (exactly-once in most cases except for when there are worker crashes)\n* Good performance (See Benchmarks).\n\n## Usage\n\nFor enqueueing items on the delay queue:\n\n```go\npackage main\n\nfunc main() {\n   err := dq.Enqueue(context.Background(), []delayq.Item{\n      {\n         At:    time.Now().Add(1 * time.Hour),\n         Value: \"Item 1!\",\n      },\n      {\n         At:    time.Now().Add(2 * time.Hour),\n         Value: \"Item 2!\",\n      },\n   }...)\n}\n```\n\nCreating a worker to process:\n\n```go\npackage main\n\nimport \"github.com/spy16/delayq\"\n\nfunc worker(dq delayq.DelayQ) {\n   w := \u0026delayq.Worker{\n      Queue:  dq,\n      Invoke: onReady,\n   }\n\n   // run worker threads that invoke myFunc for every item.\n   if err := w.Run(context.Background()); err != nil {\n      log.Fatalf(\"run exited: %v\", err)\n   }\n}\n\nfunc onReady(ctx context.Context, item delayq.Item) error {\n   log.Printf(\"got message: %v\", item)\n   return nil\n}\n```\n\n## Benchmarks\n\nBenchmarks can be re-produced using the example application in `./example`.\n\nFollowing are few actual benchmark results that I got:\n\n\u003e Both Redis and worker are running on single node with following specs:\n\u003e * CPU   : `2.8 GHz Quad-Core Intel Core i7`\n\u003e * Memory: `16 GB 2133 MHz LPDDR3`\n\n1. With 3 worker processes (30 goroutines, prefetch count 100, poll interval 5ms):\n    * 10k jobs are delivered on the exact requested second (~3300 req/second each.)\n    * 100k jobs are delivered within 3 seconds. (upto 12000 req/second each.)\n2. With 2 worker processes (20 goroutines, prefetch count 1000, poll interval 5ms):\n    * 10k jobs are delivered on the exact requested second (~5000 req/second each.)\n    * 100k jobs are delivered within 3 seconds. (upto 20000 req/second each.)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspy16%2Fdelayq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspy16%2Fdelayq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspy16%2Fdelayq/lists"}