{"id":15650526,"url":"https://github.com/yale8848/gorpool","last_synced_at":"2025-09-21T12:06:21.781Z","repository":{"id":57483577,"uuid":"116567974","full_name":"yale8848/gorpool","owner":"yale8848","description":"Simple Goroutine pool ","archived":false,"fork":false,"pushed_at":"2019-09-11T03:22:56.000Z","size":12,"stargazers_count":36,"open_issues_count":0,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-30T18:07:56.519Z","etag":null,"topics":["golang","goroutine","pool","routines"],"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/yale8848.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":"2018-01-07T13:33:21.000Z","updated_at":"2024-07-09T09:50:30.000Z","dependencies_parsed_at":"2022-08-28T17:01:47.943Z","dependency_job_id":null,"html_url":"https://github.com/yale8848/gorpool","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/yale8848%2Fgorpool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yale8848%2Fgorpool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yale8848%2Fgorpool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yale8848%2Fgorpool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yale8848","download_url":"https://codeload.github.com/yale8848/gorpool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251758167,"owners_count":21638989,"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","goroutine","pool","routines"],"created_at":"2024-10-03T12:34:57.664Z","updated_at":"2025-09-21T12:06:16.737Z","avatar_url":"https://github.com/yale8848.png","language":"Go","readme":"# gorpool\n\nSimple Goroutine pool \n\n# How to use\n\n```\ngo get github.com/yale8848/gorpool@v0.1.0\n```\n\n## Simple example\n\n```go\n\npackage main\n\nimport (\n\t\"github.com/yale8848/gorpool\"\n\t\"time\"\n\t\"fmt\"\n)\n\nfunc main() {\n\n    // workerNum is worker number of goroutine pool ,one worker have one goroutine ,\n    // jobNum is job number of job pool\n\tp := gorpool.NewPool(5, 10).\n\t\tStart()\n\tdefer p.StopAll()\n\tfor i := 0; i \u003c 100; i++ {\n\t\tcount := i\n\t\tp.AddJob(func() {\n\t\t\ttime.Sleep(10 * time.Millisecond)\n\t\t\tfmt.Printf(\"%d\\r\\n\", count)\n\t\t})\n\n\t}\n\ttime.Sleep(2 * time.Second)\n}\n\n```\n\n## WaitForAll\n\n```go\n\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/yale8848/gorpool\"\n\t\"time\"\n)\n\nfunc main() {\n\n\tp := gorpool.NewPool(5, 10).\n\t\tStart().\n\t\tEnableWaitForAll(true)\n\tfor i := 0; i \u003c 100; i++ {\n\t\tcount := i\n\t\tp.AddJob(func() {\n\t\t\ttime.Sleep(10 * time.Millisecond)\n\t\t\tfmt.Printf(\"%d\\r\\n\", count)\n\t\t})\n\t}\n\tp.WaitForAll()\n\tp.StopAll()\n}\n\n```\n\n\n## SetIdleDuration\n\nAfter set idle duration , the worker will stop it worker go routine \n\n```go\n\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/yale8848/gorpool\"\n\t\"time\"\n)\n\nfunc main() {\n\n\tp := gorpool.NewPool(5, 10).\n\t\tSetIdleDuration(3 * time.Second).\n\t\tStart().\n\t\tEnableWaitForAll(true)\n\tfor i := 0; i \u003c 100; i++ {\n\t\tcount := i\n\t\tp.AddJob(func() {\n\t\t\ttime.Sleep(5 * time.Second)\n\t\t\tfmt.Printf(\"%d\\r\\n\", count)\n\t\t})\n\t}\n\tp.WaitForAll()\n\tp.StopAll()\n}\n\n```\n\n## Doc\n\n[gorpool doc](https://godoc.org/github.com/yale8848/gorpool)\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyale8848%2Fgorpool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyale8848%2Fgorpool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyale8848%2Fgorpool/lists"}