{"id":13690789,"url":"https://github.com/bsm/ratelimit","last_synced_at":"2025-04-05T20:09:43.481Z","repository":{"id":29104016,"uuid":"32633408","full_name":"bsm/ratelimit","owner":"bsm","description":"Simple, thread-safe Go rate-limiter","archived":false,"fork":false,"pushed_at":"2023-10-16T08:25:26.000Z","size":19,"stargazers_count":81,"open_issues_count":0,"forks_count":17,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-03-29T19:07:51.591Z","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":"mit","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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-03-21T13:40:35.000Z","updated_at":"2024-10-23T07:22:51.000Z","dependencies_parsed_at":"2023-10-16T18:26:40.320Z","dependency_job_id":null,"html_url":"https://github.com/bsm/ratelimit","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":"0.052631578947368474","last_synced_commit":"fe7f7b140cc775a79002c4f6bbb86ff00135f572"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Fratelimit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Fratelimit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Fratelimit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bsm%2Fratelimit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bsm","download_url":"https://codeload.github.com/bsm/ratelimit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393574,"owners_count":20931813,"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-08-02T17:00:31.654Z","updated_at":"2025-04-05T20:09:43.458Z","avatar_url":"https://github.com/bsm.png","language":"Go","funding_links":[],"categories":["开源类库","General","Open source library"],"sub_categories":["限流器","Current Limiter"],"readme":"# RateLimit\n\n[![GoDoc](https://pkg.go.dev/badge/github.com/bsm/ratelimit)](https://pkg.go.dev/github.com/bsm/ratelimit)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nSimple, thread-safe Go rate-limiter.\nInspired by Antti Huima's algorithm on http://stackoverflow.com/a/668327\n\n### Example\n\n```go\npackage main\n\nimport (\n  \"github.com/bsm/ratelimit/v3\"\n  \"log\"\n)\n\nfunc main() {\n  // Create a new rate-limiter, allowing up-to 10 calls\n  // per second\n  rl := ratelimit.New(10, time.Second)\n\n  for i:=0; i\u003c20; i++ {\n    if rl.Limit() {\n      fmt.Println(\"Doh! Over limit!\")\n    } else {\n      fmt.Println(\"OK\")\n    }\n  }\n}\n```\n\n### Documentation\n\nFull documentation is available on [pkg.go.dev](https://pkg.go.dev/github.com/bsm/ratelimit).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsm%2Fratelimit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbsm%2Fratelimit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbsm%2Fratelimit/lists"}