{"id":21893293,"url":"https://github.com/btfak/later","last_synced_at":"2025-10-07T16:11:54.232Z","repository":{"id":73524850,"uuid":"102570774","full_name":"btfak/later","owner":"btfak","description":"A redis base delay queue","archived":false,"fork":false,"pushed_at":"2017-09-11T02:19:18.000Z","size":23,"stargazers_count":25,"open_issues_count":0,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-05T04:14:40.415Z","etag":null,"topics":["delay-queue","redis"],"latest_commit_sha":null,"homepage":null,"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/btfak.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":"2017-09-06T06:22:52.000Z","updated_at":"2025-04-09T07:23:34.000Z","dependencies_parsed_at":"2024-01-20T04:15:18.530Z","dependency_job_id":null,"html_url":"https://github.com/btfak/later","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/btfak/later","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btfak%2Flater","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btfak%2Flater/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btfak%2Flater/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btfak%2Flater/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/btfak","download_url":"https://codeload.github.com/btfak/later/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btfak%2Flater/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278804175,"owners_count":26048846,"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-10-07T02:00:06.786Z","response_time":59,"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":["delay-queue","redis"],"created_at":"2024-11-28T13:13:16.661Z","updated_at":"2025-10-07T16:11:54.192Z","avatar_url":"https://github.com/btfak.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## LATER ![](https://travis-ci.org/btfak/later.svg?branch=master)\nLater is a redis base delay queue\n\n### Usege\ngolang version: 1.7+\n```\ngo build github.com/btfak/later\n$: ./later -h\nUsage of ./later:\n  -address string\n    \tserve listen address (default \":8080\")\n  -redis string\n    \tredis address (default \"redis://127.0.0.1:6379/0\")\n```\n\n### Feature\n\n- Delay push message to target\n- At-lease-once delivery\n- Fail and retry\n- Reliable\n- Performance\n\n\n### Frontend API\n\nResponse http code: **200** success, **400** request invalid, **404** task not found, **500** internal error\n\n- Create Task\n\n  ```\n  Request:\n  POST /create\n  {\n  \t\"topic\":\"order\",\n  \t\"delay\":15, // second\n  \t\"retry\":3,  // max retry 3 times, interval 10,20,40... seconds\n  \t\"callback\":\"http://127.0.0.1:8888/\", // http post to target url\n  \t\"content\":\"hello\" // content to post\n  }\n  Response:\n  {\n      \"id\": \"35adbde5-77c4-4d65-adac-0082d91f2554\"\n  }\n  ```\n\n- Delete Task\n\n  ```\n  Request:\n  POST /delete\n  {\n  \t\"id\":\"35adbde5-77c4-4d65-adac-0082d91f2554\"\n  }\n  ```\n\n- Query Task\n\n  ```\n  Request:\n  POST /query\n  {\n  \t\"id\":\"35adbde5-77c4-4d65-adac-0082d91f2554\"\n  }\n  Response:\n  {\n      \"id\": \"cb9aefdd-5bd1-4bf3-8c94-1ed5c2ea638e\",\n      \"topic\": \"order\",\n      \"execute_time\": 1504934230,\n      \"max_retry\": 1,\n      \"has_retry\": 0,\n      \"callback\": \"http://127.0.0.1:8888/success\",\n      \"content\": \"hello\",\n      \"creat_time\": 1504934220\n  }\n  ```\n\n## Backend API\n\n- Callback\n\n  ```\n  Request:\n  POST /?\n  {\n    \"id\": \"57e177ff-454c-42d6-93ab-65895b950dbf\",\n    \"topic\": \"order\",\n    \"content\": \"hello\"\n  }\n  Response:\n  {\n      \"code\":100 // 100: success,101: too many request,other: fail\n  }\n  ```\n\n  At-lease-once delivery, may repeat delivery.  Backend api should idempotent and always return response.\n\n## Inside Later\n\n**Later has  four storage part**\n\n* Task Pool: kv pairs hold fully task data\n* Delay Bucket: a sorted set store task id and execute time, which waiting to execute by worker\n* Unack Bucket: a sorted set store task which has called backend server and waiting response\n* Error Bucket: a sorted set store task which call backend server fail\n\n**Three worker fetch tasks with time ticker**\n\n* Delay Worker: get tasks which reach execute time and move tasks from delay bucket to unack bucket, if call backend server success, delete all task data. Otherwise, move tasks from delay bucket to error bucket\n* Unack Worker: move tasks from unack bucket to delay bucket\n* Error Worker: move tasks from error bucket to delay bucket\n\n**Concurrence problem**\n\nIn general, we will deploy multi instance, workers will get same task, but we judge result when move task from delay bucket to unack bucket, if `ZADD` return 1, worker move on, otherwise worker return immediately.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtfak%2Flater","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbtfak%2Flater","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtfak%2Flater/lists"}