{"id":21534478,"url":"https://github.com/b1nary-gr0up/violin","last_synced_at":"2025-10-29T13:02:47.096Z","repository":{"id":174238121,"uuid":"649251559","full_name":"B1NARY-GR0UP/violin","owner":"B1NARY-GR0UP","description":"VIOLIN worker/connection pool","archived":false,"fork":false,"pushed_at":"2024-07-13T05:17:34.000Z","size":107,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T03:23:34.303Z","etag":null,"topics":["connection-pool","go","worker-pool"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/B1NARY-GR0UP.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-04T09:17:48.000Z","updated_at":"2024-10-09T12:18:12.000Z","dependencies_parsed_at":"2024-01-23T19:51:45.190Z","dependency_job_id":null,"html_url":"https://github.com/B1NARY-GR0UP/violin","commit_stats":null,"previous_names":["b1nary-gr0up/violin"],"tags_count":6,"template":false,"template_full_name":"B1NARY-GR0UP/.github","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/B1NARY-GR0UP%2Fviolin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/B1NARY-GR0UP%2Fviolin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/B1NARY-GR0UP%2Fviolin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/B1NARY-GR0UP%2Fviolin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/B1NARY-GR0UP","download_url":"https://codeload.github.com/B1NARY-GR0UP/violin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142192,"owners_count":21054604,"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":["connection-pool","go","worker-pool"],"created_at":"2024-11-24T03:10:55.032Z","updated_at":"2025-10-29T13:02:42.034Z","avatar_url":"https://github.com/B1NARY-GR0UP.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![VIOLIN](images/VIOLIN.png)\n\nVIOLIN worker pool / connection pool, rich APIs and configuration options are provided.\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/B1NARY-GR0UP/violin)](https://goreportcard.com/report/github.com/B1NARY-GR0UP/violin)\n\n## Install\n\n```shell\ngo get github.com/B1NARY-GR0UP/violin\n```\n\n## Quick Start\n\n### Worker Pool\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/B1NARY-GR0UP/violin\"\n)\n\nfunc main() {\n\tv := violin.New()\n\tdefer v.Shutdown()\n\tv.Submit(func() {\n\t\tfmt.Println(\"Hello, VIOLIN!\")\n\t})\n}\n```\n\n### Connection Pool\n\n```go\npackage main\n\nimport (\n\t\"net\"\n\t\"time\"\n\n\t\"github.com/B1NARY-GR0UP/violin/cool\"\n)\n\nfunc main() {\n\tproducer := func() (net.Conn, error) {\n\t\treturn net.Dial(\"your-network\", \"your-address\")\n\t}\n\tc, _ := cool.New(5, 30, producer, cool.WithConnIdleTimeout(30*time.Second))\n\tdefer c.Close()\n\t_ = c.Len()\n\tconn, _ := c.Get()\n\t_ = conn.Close()\n\tif cc, ok := conn.(*cool.Conn); ok {\n\t\tcc.MarkUnusable()\n\t\tif cc.IsUnusable() {\n\t\t\t_ = cc.Close()\n\t\t}\n\t}\n}\n```\n\n## Configuration\n\n### Worker Pool\n\n| Option                  | Default           | Description                               |\n|-------------------------|-------------------|-------------------------------------------|\n| `WithMinWorkers`        | `0`               | Set the minimum number of workers         |\n| `WithMaxWorkers`        | `5`               | Set the maximum number of workers         |\n| `WithWorkerIdleTimeout` | `3 * time.Second` | Set the destroyed timeout of idle workers |\n\n### Connection Pool\n\n| Option                | Default | Description                     |\n|-----------------------|---------|---------------------------------|\n| `WithConnIdleTimeout` | `0`     | Set the connection idle timeout |\n\n## Blogs\n\n- [GO: How to Write a Worker Pool](https://dev.to/justlorain/go-how-to-write-a-worker-pool-1h3b) | [中文](https://juejin.cn/post/7244733519948333111)\n\n## Credits\n\nSincere appreciation to the following repositories that made the development of VIOLIN possible.\n\n- [gammazero/workerpool](https://github.com/gammazero/workerpool)\n- [fatih/pool](https://github.com/fatih/pool)\n\n## License\n\nVIOLIN is distributed under the [Apache License 2.0](./LICENSE). The licenses of third party dependencies of VIOLIN are explained [here](./licenses).\n\n## ECOLOGY\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/justlorain/justlorain/blob/main/images/BMS.png\" alt=\"BMS\"/\u003e\n\u003cbr/\u003e\u003cbr/\u003e\nVIOLIN is a Subproject of the \u003ca href=\"https://github.com/B1NARY-GR0UP\"\u003eBasic Middleware Service\u003c/a\u003e\n\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb1nary-gr0up%2Fviolin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb1nary-gr0up%2Fviolin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb1nary-gr0up%2Fviolin/lists"}