{"id":23129024,"url":"https://github.com/twiny/ratelimit","last_synced_at":"2025-08-01T17:10:08.625Z","repository":{"id":57695675,"uuid":"490340500","full_name":"twiny/ratelimit","owner":"twiny","description":"A Golang blocking leaky-bucket rate limiter","archived":false,"fork":false,"pushed_at":"2022-05-09T16:34:37.000Z","size":2,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T02:33:30.461Z","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/twiny.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":"2022-05-09T15:28:25.000Z","updated_at":"2024-11-04T10:44:25.000Z","dependencies_parsed_at":"2022-09-06T10:41:57.350Z","dependency_job_id":null,"html_url":"https://github.com/twiny/ratelimit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/twiny/ratelimit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twiny%2Fratelimit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twiny%2Fratelimit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twiny%2Fratelimit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twiny%2Fratelimit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twiny","download_url":"https://codeload.github.com/twiny/ratelimit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twiny%2Fratelimit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268265832,"owners_count":24222526,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"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":[],"created_at":"2024-12-17T10:08:07.164Z","updated_at":"2025-08-01T17:10:08.588Z","avatar_url":"https://github.com/twiny.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Leaky bucket rate limiter\n\nA Go implementation of the leaky-bucket rate limit algorithm. \n\n## Install\n`go get github.com/twiny/ratelimit`\n\n## API\n\n```go\nTake() time.Time\nRate() int\nDuration() time.Duration\nString() string\n```\n\n## Example\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/twiny/ratelimit\"\n)\n\n// main\nfunc main() {\n\tlimiter := ratelimit.NewLimiter(10, 1*time.Second) // 10 request per second\n\n\tprev := time.Now()\n\tfor i := 0; i \u003c 10; i++ {\n\t\tnow := limiter.Take()\n\t\tfmt.Println(i, now.Sub(prev))\n\t\tprev = now\n\t}\n}\n\n// output:\n// 0 239ns\n// 1 100ms\n// 2 100ms\n// 3 100ms\n// 4 100ms\n// 5 100ms\n// 6 100ms\n// 7 100ms\n// 8 100ms\n// 9 100ms\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwiny%2Fratelimit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwiny%2Fratelimit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwiny%2Fratelimit/lists"}