{"id":13413084,"url":"https://github.com/dirkaholic/kyoo","last_synced_at":"2025-08-01T16:36:46.348Z","repository":{"id":57508077,"uuid":"232180875","full_name":"dirkaholic/kyoo","owner":"dirkaholic","description":"Unlimited job queue for go, using a pool of concurrent workers processing the job queue entries","archived":false,"fork":false,"pushed_at":"2023-02-21T14:03:27.000Z","size":387,"stargazers_count":49,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T05:41:50.378Z","etag":null,"topics":["go","golang","golang-library","job-queue","queue","rabbitmq","sqs","worker"],"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/dirkaholic.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-01-06T20:35:11.000Z","updated_at":"2025-02-11T21:34:52.000Z","dependencies_parsed_at":"2024-01-08T15:34:38.909Z","dependency_job_id":null,"html_url":"https://github.com/dirkaholic/kyoo","commit_stats":{"total_commits":10,"total_committers":3,"mean_commits":"3.3333333333333335","dds":"0.19999999999999996","last_synced_commit":"9ae445c9faa96238cb604edd4fe91b6d347586db"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dirkaholic/kyoo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirkaholic%2Fkyoo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirkaholic%2Fkyoo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirkaholic%2Fkyoo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirkaholic%2Fkyoo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dirkaholic","download_url":"https://codeload.github.com/dirkaholic/kyoo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirkaholic%2Fkyoo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259716044,"owners_count":22900775,"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":["go","golang","golang-library","job-queue","queue","rabbitmq","sqs","worker"],"created_at":"2024-07-30T20:01:33.263Z","updated_at":"2025-06-13T20:34:31.012Z","avatar_url":"https://github.com/dirkaholic.png","language":"Go","funding_links":[],"categories":["Goroutines","Goroutines `goroutines的管理和使用`","Relational Databases"],"sub_categories":["Search and Analytic Databases","SQL 查询语句构建库","Advanced Console UIs","检索及分析资料库"],"readme":"# kyoo: A Go library providing an unlimited job queue and concurrent worker pools\n\n![Build](https://gitlab.com/dirkaholic/kyoo/badges/master/pipeline.svg) ![Coverage](https://gitlab.com/dirkaholic/kyoo/badges/master/coverage.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/dirkaholic/kyoo)](https://goreportcard.com/report/github.com/dirkaholic/kyoo)\n\n## About\n\nkyoo is the phonetic transcription of the word queue. It provides a job queue that can hold as much jobs as\nresources are available on the running system.\n\nThe queue has the following characteristics:\n* No limit of jobs to be queued (only limited by system resources = memory)\n* Concurrent processing of jobs using worker pools\n* When stopping queue, pending jobs are still processed\n\nThe library contains a simple `Job` interface and a simple `FuncExecutorJob` that\njust executes a given function and implements that interface. With that nearly all\nkinds of workloads should be processable already but of course it is possible to add\ncustom implementations of the `Job` interface.\n\nPossible use cases for the library are:\n* Consumers for message queues like RabbitMQ or Amazon SQS\n* Processing web server requests offloading time extensive work into background jobs\n* All kinds of backend processing jobs like image optimization, etc.\n\n## Example\n\nThe following example shows a simple http server offloading jobs to the jobqueue that is constantly\nprocessed in the background.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\t\"runtime\"\n\t\"time\"\n\n\tjobqueue \"github.com/dirkaholic/kyoo\"\n\t\"github.com/dirkaholic/kyoo/job\"\n)\n\nvar queue *jobqueue.JobQueue\n\nfunc handler(w http.ResponseWriter, r *http.Request) {\n\tqueue.Submit(\u0026job.FuncExecutorJob{Func: func() error {\n\t\treturn doTheHeavyBackgroundWork(r.URL.Path)\n\t}})\n\tfmt.Printf(\"%s - submitted %s !!\\n\", time.Now().String(), r.URL.Path)\n\n\tfmt.Fprint(w, \"Job added to queue.\")\n}\n\nfunc main() {\n\tqueue = jobqueue.NewJobQueue(runtime.NumCPU() * 2)\n\tqueue.Start()\n\n\thttp.HandleFunc(\"/\", handler)\n\tlog.Fatal(http.ListenAndServe(\":8080\", nil))\n}\n\nfunc doTheHeavyBackgroundWork(path string) error {\n\ttime.Sleep(2 * time.Second)\n\tfmt.Printf(\"%s - processed %s !!\\n\", time.Now().String(), path)\n\treturn nil\n}\n```\n\nTest the offloading by sending a bunch of http requests to the server \n\n```bash\n$ for i in {1..10}; do http http://127.0.0.1:8080/test/$i; done\n````\n\nThe output on http server side should be similar like this\n\n```bash\n2020-01-09 21:36:36.156277 +0100 CET m=+5.733617272 - submitted /test/1 !!\n2020-01-09 21:36:36.443521 +0100 CET m=+6.020861136 - submitted /test/2 !!\n2020-01-09 21:36:36.730535 +0100 CET m=+6.307874793 - submitted /test/3 !!\n2020-01-09 21:36:37.021405 +0100 CET m=+6.598744533 - submitted /test/4 !!\n2020-01-09 21:36:37.311973 +0100 CET m=+6.889312431 - submitted /test/5 !!\n2020-01-09 21:36:37.609868 +0100 CET m=+7.187208115 - submitted /test/6 !!\n2020-01-09 21:36:37.895222 +0100 CET m=+7.472561850 - submitted /test/7 !!\n2020-01-09 21:36:38.160524 +0100 CET m=+7.737863891 - processed /test/1 !!\n2020-01-09 21:36:38.171491 +0100 CET m=+7.748830724 - submitted /test/8 !!\n2020-01-09 21:36:38.445832 +0100 CET m=+8.023171514 - processed /test/2 !!\n2020-01-09 21:36:38.448423 +0100 CET m=+8.025762679 - submitted /test/9 !!\n2020-01-09 21:36:38.730541 +0100 CET m=+8.307880933 - submitted /test/10 !!\n2020-01-09 21:36:38.735158 +0100 CET m=+8.312497505 - processed /test/3 !!\n2020-01-09 21:36:39.024788 +0100 CET m=+8.602128093 - processed /test/4 !!\n2020-01-09 21:36:39.315991 +0100 CET m=+8.893331115 - processed /test/5 !!\n2020-01-09 21:36:39.614848 +0100 CET m=+9.192187633 - processed /test/6 !!\n2020-01-09 21:36:39.896692 +0100 CET m=+9.474031970 - processed /test/7 !!\n2020-01-09 21:36:40.175952 +0100 CET m=+9.753291345 - processed /test/8 !!\n2020-01-09 21:36:40.451877 +0100 CET m=+10.029216847 - processed /test/9 !!\n2020-01-09 21:36:40.734289 +0100 CET m=+10.311628415 - processed /test/10 !!\n```\n\n## More examples\n\n* [SQS worker](examples/sqsworker)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirkaholic%2Fkyoo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdirkaholic%2Fkyoo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirkaholic%2Fkyoo/lists"}