{"id":13413064,"url":"https://github.com/zenthangplus/goccm","last_synced_at":"2026-01-18T04:25:29.711Z","repository":{"id":48335265,"uuid":"202644046","full_name":"zenthangplus/goccm","owner":"zenthangplus","description":"Limits the number of goroutines that are allowed to run concurrently","archived":false,"fork":false,"pushed_at":"2023-01-18T03:38:06.000Z","size":16,"stargazers_count":69,"open_issues_count":3,"forks_count":14,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-31T20:51:54.212Z","etag":null,"topics":["concurrency","golang","goroutine"],"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/zenthangplus.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":"2019-08-16T02:26:53.000Z","updated_at":"2024-07-17T01:32:57.000Z","dependencies_parsed_at":"2023-02-10T13:00:32.318Z","dependency_job_id":null,"html_url":"https://github.com/zenthangplus/goccm","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/zenthangplus/goccm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenthangplus%2Fgoccm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenthangplus%2Fgoccm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenthangplus%2Fgoccm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenthangplus%2Fgoccm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zenthangplus","download_url":"https://codeload.github.com/zenthangplus/goccm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenthangplus%2Fgoccm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28529529,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["concurrency","golang","goroutine"],"created_at":"2024-07-30T20:01:33.007Z","updated_at":"2026-01-18T04:25:29.694Z","avatar_url":"https://github.com/zenthangplus.png","language":"Go","funding_links":[],"categories":["Goroutines","Goroutines `goroutines的管理和使用`","Relational Databases"],"sub_categories":["Search and Analytic Databases","Advanced Console UIs","检索及分析资料库","SQL 查询语句构建库"],"readme":"# Golang Concurrency Manager\n\n[![run tests](https://github.com/zenthangplus/goccm/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/zenthangplus/goccm/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/zenthangplus/goccm/branch/master/graph/badge.svg)](https://codecov.io/gh/zenthangplus/goccm)\n[![goreportcard](https://goreportcard.com/badge/github.com/zenthangplus/goccm)](https://goreportcard.com/report/github.com/zenthangplus/goccm)\n\nGolang Concurrency Manager package limits the number of goroutines that are allowed to run concurrently.\n\n### Installation\n\nRun the following command to install this package:\n\n```\n$ go get -u github.com/zenthangplus/goccm\n```\n\n### Example\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/zenthangplus/goccm\"\n    \"time\"\n)\n\nfunc main() {\n    // Limit 3 goroutines to run concurrently.\n    c := goccm.New(3)\n\n    for i := 1; i \u003c= 10; i++ {\n\n        // This function has to call before any goroutine\n        c.Wait()\n\n        go func(i int) {\n            fmt.Printf(\"Job %d is running\\n\", i)\n            time.Sleep(2 * time.Second)\n\n            // This function has to when a goroutine has finished\n            // Or you can use `defer c.Done()` at the top of goroutine.\n            c.Done()\n        }(i)\n    }\n\n    // This function has to call to ensure all goroutines have finished\n    // after close the main program.\n    c.WaitAllDone()\n}\n```\n\n### List of supported functions\n\n```go\npackage main\n\nimport \"github.com/zenthangplus/goccm\"\n\nfunc main() {\n    // Create the concurrency manager\n    // The first argument is the maximum number of goroutines to run concurrently.\n    c := goccm.New(10)\n\n    // Wait until a slot is available for the new goroutine.\n    c.Wait()\n\n    // Mark a goroutine as finished\n    c.Done()\n\n    // Wait for all goroutines are done\n    c.WaitAllDone()\n\n    // Close the manager manually\n    c.Close()\n\n    // Returns the number of goroutines which are running\n    c.RunningCount()\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenthangplus%2Fgoccm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzenthangplus%2Fgoccm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenthangplus%2Fgoccm/lists"}