{"id":13709413,"url":"https://github.com/kataras/chronos","last_synced_at":"2025-07-17T04:34:10.518Z","repository":{"id":37580111,"uuid":"107710499","full_name":"kataras/chronos","owner":"kataras","description":"NEW: Chronos provides an easy way to limit X operations per Y time in accuracy of nanoseconds","archived":false,"fork":false,"pushed_at":"2018-02-24T01:38:41.000Z","size":18,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T01:51:10.053Z","etag":null,"topics":["go","golang","rate-limits","time"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kataras.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2017-10-20T18:05:29.000Z","updated_at":"2023-04-22T17:52:15.000Z","dependencies_parsed_at":"2022-08-29T09:42:04.466Z","dependency_job_id":null,"html_url":"https://github.com/kataras/chronos","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/kataras%2Fchronos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kataras%2Fchronos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kataras%2Fchronos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kataras%2Fchronos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kataras","download_url":"https://codeload.github.com/kataras/chronos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248339262,"owners_count":21087214,"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":["go","golang","rate-limits","time"],"created_at":"2024-08-02T23:00:38.947Z","updated_at":"2025-04-11T03:50:55.559Z","avatar_url":"https://github.com/kataras.png","language":"Go","funding_links":[],"categories":["Repositories"],"sub_categories":[],"readme":"# chronos [![build status](https://img.shields.io/travis/kataras/chronos/master.svg?style=flat-square)](https://travis-ci.org/kataras/chronos)[![report card](https://img.shields.io/badge/report%20card-a%2B-ff3333.svg?style=flat-square)](http://goreportcard.com/report/kataras/chronos)[![github issues](https://img.shields.io/github/issues/kataras/chronos.svg?style=flat-square)](https://github.com/kataras/chronos/issues?q=is%3Aopen+is%3Aissue)[![github closed issues](https://img.shields.io/github/issues-closed-raw/kataras/chronos.svg?style=flat-square)](https://github.com/kataras/chronos/issues?q=is%3Aissue+is%3Aclosed)[![release](https://img.shields.io/github/release/kataras/chronos.svg?style=flat-square)](https://github.com/kataras/chronos/releases)[![learn by examples](https://img.shields.io/badge/learn%20by-examples-0077b3.svg?style=flat-square)](https://github.com/kataras/chronos/tree/master/_examples)[![docs](https://img.shields.io/badge/chronos%20-godocs-0366d6.svg?style=flat-square)](https://godoc.org/github.com/kataras/chronos)\n\nChronos provides an easy way to limit X operations per Y time in accuracy of nanoseconds.\nChronos is a crucial tool when calling external, remote or even internal APIs with rate limits.\n\n### 📑 Table Of Content\n\n* [Installation](#-installation)\n* [Latest changes](HISTORY.md)\n* [Examples](#-learn)\n    * [Simple native](_examples/native-acquire)\n    * [Simple http client](_examples/http)\n* [Community \u0026 Support](#-community)\n* [Versioning](#-version)\n* [People](#-people)\n\n### 🚀 Installation\n\nThe only requirement is the [Go Programming Language](https://golang.org/dl/).\n\n```bash\n$ go get -u github.com/kataras/chronos\n```\n\n\u003e `chronos` has zero third-party dependencies rathen than the Go's standard library.\n\n`Chronos` is very simple to use tool, you just declare the maximum operations(max) and in every Y time\nthat those operations are allowed to be executed(per). `Chronos` has the accuracy of nanoseconds.\n\nYou can use `chronos#Acquire` anywhere you want, but be careful because it waits/blocks for\navailability to be executed.\n\n```go\nimport (\n    \"time\"\n\n    \"github.com/kataras/chronos\"\n)\n\nfunc main() {\n    // Allow maximum of 5 MyActions calls\n    // per 3 seconds.\n    c := chronos.New(5, 3 * time.Second)\n\n    // The below actions will execute immediately.\n    MyAction(c)\n    MyAction(c)\n    MyAction(c)\n    MyAction(c)\n    MyAction(c)\n    // The below action will execute after 3 seconds from the last call\n    // or when 3 seconds passed without any c.Acquire call.\n    MyAction(c)\n}\n\nfunc MyAction(c *chronos.C) {\n    \u003c- c.Acquire()\n    // Do something here...\n}\n```\n\nThe `\u003c- c.Acquire()` is blocking when needed, no any further actions neeeded by the end-developer.\n\n### Helpers\n\nThe [ext](ext) package provides two subpackages; `function` and `http`. Navigate there to learn how they can help you.\n\n### 📖 Learn\n\nThe awesome `chronos` community is always adding new content to learn from, [_examples](_examples/) is a great place to get started!\n\nRead the [godocs](https://godoc.org/github.com/kataras/chronos) for a better understanding.\n\n### 👥 Community\n\nJoin the welcoming community of fellow `chronos` developers in [rocket.chat](https://kataras.rocket.chat/channel/chronos)\n\n- [Post](https://github.com/kataras/chronos/issues/new) a feature request or report a bug\n- :star: and watch the public [repository](https://github.com/kataras/chronos/stargazers), will keep you up to date\n- :earth_americas: publish [an article](https://medium.com/search?q=chronos) or share a [tweet](https://twitter.com/hashtag/golang) about your personal experience with `chronos`.\n\n### 📌 Version\n\nCurrent: [0.0.1](VERSION)\n\nRead more about Semantic Versioning 2.0.0\n\n - http://semver.org/\n - https://en.wikipedia.org/wiki/Software_versioning\n - https://wiki.debian.org/UpstreamGuide#Releases_and_Versions\n\n### 🥇 People\n\nThe original author of `chronos` is [@kataras](https://github.com/kataras), you can reach him via;\n\n- [Medium](https://medium.com/@kataras)\n- [Twitter](https://twitter.com/makismaropoulos)\n- [Dev.to](https://dev.to/@kataras)\n- [Facebook](https://facebook.com/kataras.gopher)\n- [Mail](mailto:kataras2006@hotmail.com?subject=Chronos%20I%20need%20some%20help%20please)\n\n[List of all Authors](AUTHORS)\n\n[List of all Contributors](https://github.com/kataras/chronos/graphs/contributors)\n\n## License\n\nThis software is licensed under the open source 3-Clause BSD License.\n\nYou can find the license file [here](LICENSE), for any questions regarding the license please [contact with me](mailto:mailto:kataras2006@hotmail.com?subject=Chronos%20License).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkataras%2Fchronos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkataras%2Fchronos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkataras%2Fchronos/lists"}