{"id":43988367,"url":"https://github.com/gasparian/worker-pool-go","last_synced_at":"2026-02-07T10:10:21.904Z","repository":{"id":49295862,"uuid":"371933899","full_name":"gasparian/worker-pool-go","owner":"gasparian","description":"Implementation of worker pool with a variable balancing strategy","archived":false,"fork":false,"pushed_at":"2022-01-30T21:09:18.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T21:38:24.466Z","etag":null,"topics":["go","go-concurrency","go-workerpool","go-workers-pool","golang","worker-pool","worker-pool-go"],"latest_commit_sha":null,"homepage":"","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/gasparian.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":"2021-05-29T09:39:01.000Z","updated_at":"2022-01-29T23:32:38.000Z","dependencies_parsed_at":"2022-09-01T01:12:02.505Z","dependency_job_id":null,"html_url":"https://github.com/gasparian/worker-pool-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gasparian/worker-pool-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gasparian%2Fworker-pool-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gasparian%2Fworker-pool-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gasparian%2Fworker-pool-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gasparian%2Fworker-pool-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gasparian","download_url":"https://codeload.github.com/gasparian/worker-pool-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gasparian%2Fworker-pool-go/sbom","scorecard":{"id":419463,"data":{"date":"2025-08-11","repo":{"name":"github.com/gasparian/worker-pool-go","commit":"76a5e82b6f82be99b031d5e30ed1fc1d4f976af8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:8: update your workflow using https://app.stepsecurity.io/secureworkflow/gasparian/worker-pool-go/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/gasparian/worker-pool-go/test.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/15 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T00:48:12.174Z","repository_id":49295862,"created_at":"2025-08-19T00:48:12.174Z","updated_at":"2025-08-19T00:48:12.174Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29192109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","go-concurrency","go-workerpool","go-workers-pool","golang","worker-pool","worker-pool-go"],"created_at":"2026-02-07T10:10:21.274Z","updated_at":"2026-02-07T10:10:21.899Z","avatar_url":"https://github.com/gasparian.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![tests](https://github.com/gasparian/worker-pool-go/actions/workflows/test.yml/badge.svg?branch=main)\n\n# worker-pool-go  \n\nImplementation of worker pool with extendable functionality.  \nBy default, I've implemented \"round-robin\" balancing to evenly distribute jobs across workers.  \nYou need to implement the `BalancingStrategy` interface in order to use other balancing strategies:  \n```go\ntype BalancingStrategy interface {\n\tNextWorkerId(workersStats []Stats) int\n}\n```  \n\nAPI:  \n```go\n// worker pool struct private api\n(wp *WorkerPool) getCurrentJobsNumber() int64\n(wp *WorkerPool) getWorkerStats(workerId int) (Stats, error)\n(wp *WorkerPool) terminateWorker(workerId int) error\n(wp *WorkerPool) reloadWorker(workerId int) error\n\n// worker pool public methods\n// New creates new instance of workers pool\n// params defining it's size and max jobs per worker (without blocking)\nNewWorkerPool(nWorkers, maxJobs uint, balancer BalancingStrategy) *WorkerPool\n// ScheduleJob puts new job in some worker queue\n(wp *WorkerPool) ScheduleJob(f JobFunc) (chan Result, error)\n\n// NewRoundRobin creates new instance of the \"load balancer\"\nNewRoundRobin() *RoundRobin\n// NextWorkerId returns worker id selected by some\n// predefined policy\n(rr *RoundRobin) NextWorkerId(workerStats []Stats) int\n```  \n\nInstall:  \n```\ngo get -u github.com/gasparian/worker-pool-go\n```  \n\nUsage example:  \n```go\npackage main\n\nimport (\n    \"fmt\"\n    wp \"github.com/gasparian/worker-pool-go\"\n)\n\n// Use closure to create job function\nfunc exampleJob(inp int) wp.JobFunc {\n    return func() wp.Result {\n        res := inp * inp\n        return wp.Result{\n            Data: res,\n            Err:  nil,\n        }\n    }\n}\n\nfunc main() {\n    pool := NewWorkerPool(\n        3,\n        10,\n        NewRoundRobin(),\n    )\n\n    // NOTE: if number of jobs per woker will be \u003e MaxJobs, \n    //       ScheduleJob func will block\n    nJobs := 50\n    results := make([]chan wp.Result, 0)\n    for i := 0; i \u003c nJobs; i++ {\n        ch := pool.ScheduleJob(exampleJob(i))\n        results = append(results, ch)\n    }\n    \n    for _, r := range results {\n        res := \u003c-r\n        fmt.Println(res)\n    }\n}\n```  \n\nRun tests:  \n```\nmake test\n```  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgasparian%2Fworker-pool-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgasparian%2Fworker-pool-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgasparian%2Fworker-pool-go/lists"}