{"id":15065495,"url":"https://github.com/kavehmz/queue","last_synced_at":"2025-04-10T17:11:46.743Z","repository":{"id":47274209,"uuid":"47111611","full_name":"kavehmz/queue","owner":"kavehmz","description":"A Go queue manager on top of Redis","archived":false,"fork":false,"pushed_at":"2021-09-05T17:05:08.000Z","size":31,"stargazers_count":74,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T14:51:23.333Z","etag":null,"topics":["golang","queue","redis"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kavehmz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-30T10:32:14.000Z","updated_at":"2024-07-09T09:49:17.000Z","dependencies_parsed_at":"2022-08-29T05:20:41.822Z","dependency_job_id":null,"html_url":"https://github.com/kavehmz/queue","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavehmz%2Fqueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavehmz%2Fqueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavehmz%2Fqueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavehmz%2Fqueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kavehmz","download_url":"https://codeload.github.com/kavehmz/queue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248261730,"owners_count":21074223,"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":["golang","queue","redis"],"created_at":"2024-09-25T00:39:17.526Z","updated_at":"2025-04-10T17:11:46.706Z","avatar_url":"https://github.com/kavehmz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Queue\n=========\n[![Go Lang](http://kavehmz.github.io/static/gopher/gopher-front.svg)](https://golang.org/)\n[![GoDoc](https://godoc.org/github.com/kavehmz/queue?status.svg)](https://godoc.org/github.com/kavehmz/queue)\n![Build Status](https://github.com/kavehmz/queue/actions/workflows/go.yml/badge.svg?branch=master)\n[![Coverage Status](https://coveralls.io/repos/kavehmz/queue/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/kavehmz/queue?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/kavehmz/queue)](https://goreportcard.com/report/github.com/kavehmz/queue)\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/kavehmz/queue)\n\nA [Go](http://golang.org) library for managing queues on top of Redis.\nIt is based on a hiring exercise but later I found it useful for myself in a custom task processing project.\nI thought it might be useful in general.\n\n\n## Installation\n\n```bash\n$ go get github.com/kavehmz/queue\n```\n\n# Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/kavehmz/queue\"\n)\n\nfunc main() {\n\tvar q queue.Queue\n\tq.Urls([]string{\"redis://localhost:6379\"})\n\tq.AddTask(1, \"start\")\n\tq.AddTask(2, \"start\")\n\tq.AddTask(1, \"stop\")\n\tq.AddTask(2, \"stop\")\n\tanalyzer := func(id int, task chan string, success chan bool) {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase msg := \u003c-task:\n\t\t\t\tfmt.Println(id, msg)\n\t\t\t\tif msg == \"stop\" {\n\t\t\t\t\tsuccess \u003c- true\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tcase \u003c-time.After(2 * time.Second):\n\t\t\t\tfmt.Println(\"no new events for 2 seconds for ID\", id)\n\t\t\t\tsuccess \u003c- false\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\texitOnEmpty := func() bool {\n\t\treturn true\n\t}\n\tq.AnalysePool(1, exitOnEmpty, analyzer)\n}\n```\n\n## Approach\n\nFocus of this design is mainly horizontal scalability via concurrency, partitioning and fault-detection.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavehmz%2Fqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkavehmz%2Fqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavehmz%2Fqueue/lists"}