{"id":18418582,"url":"https://github.com/bsm/workhorse","last_synced_at":"2025-10-26T00:09:20.247Z","repository":{"id":57520274,"uuid":"250493480","full_name":"bsm/workhorse","owner":"bsm","description":"A simple worker abstraction on top of sync/errgroup with custom middlewares.","archived":false,"fork":false,"pushed_at":"2020-03-27T11:26:45.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-13T19:04:14.598Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bsm.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":"2020-03-27T09:33:19.000Z","updated_at":"2020-04-15T07:56:33.000Z","dependencies_parsed_at":"2022-09-05T11:22:12.269Z","dependency_job_id":null,"html_url":"https://github.com/bsm/workhorse","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bsm/workhorse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Fworkhorse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Fworkhorse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Fworkhorse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Fworkhorse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bsm","download_url":"https://codeload.github.com/bsm/workhorse/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Fworkhorse/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259704411,"owners_count":22898858,"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":[],"created_at":"2024-11-06T04:14:05.175Z","updated_at":"2025-10-26T00:09:15.190Z","avatar_url":"https://github.com/bsm.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Workhorse\n\n[![Build Status](https://travis-ci.org/bsm/workhorse.svg)](https://travis-ci.org/bsm/workhorse)\n[![GoDoc](https://godoc.org/github.com/bsm/workhorse?status.png)](http://godoc.org/github.com/bsm/workhorse)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nA simple worker abstraction on top of [errgroup](https://pkg.go.dev/golang.org/x/sync/errgroup) with custom middlewares.\n\n## Examples\n\n```go\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"sync/atomic\"\n\n\t\"github.com/bsm/workhorse\"\n)\n\nfunc main() {\n\t// define root context\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\tvar count uint32\n\n\t// init a worker\n\tw := workhorse.New(ctx)\n\n\t// schedule task \"one\"\n\tw.Go(\"one\", func(_ context.Context) error {\n\t\tfor i := 0; i \u003c 1000; i++ {\n\t\t\tatomic.AddUint32(\u0026count, 1)\n\t\t}\n\t\treturn nil\n\t})\n\n\t// schedule task \"two\"\n\tw.Go(\"two\", func(_ context.Context) error {\n\t\tfor i := 0; i \u003c 1000; i++ {\n\t\t\tatomic.AddUint32(\u0026count, 2)\n\t\t}\n\t\treturn nil\n\t})\n\n\t// wait for both tasks to complete\n\tif err := w.Wait(); err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(count)\n\t// Output:\n\t// 3000}\n```\n\n## Documentation\n\nFull documentation is available on [GoDoc](https://pkg.go.dev/github.com/bsm/workhorse)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsm%2Fworkhorse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsm%2Fworkhorse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsm%2Fworkhorse/lists"}