{"id":8908809,"url":"https://github.com/kitstack/async-job","last_synced_at":"2026-04-20T08:12:48.328Z","repository":{"id":39619333,"uuid":"458520255","full_name":"kitstack/async-job","owner":"kitstack","description":"AsyncJob is an asynchronous queue job manager with light code, clear and speed. I hope so ! 😬","archived":false,"fork":false,"pushed_at":"2022-05-30T18:51:58.000Z","size":17,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-26T11:13:00.400Z","etag":null,"topics":["async","lightweight","queue","simple"],"latest_commit_sha":null,"homepage":"","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/kitstack.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-02-12T12:49:26.000Z","updated_at":"2025-03-31T10:02:33.000Z","dependencies_parsed_at":"2022-08-26T05:12:11.857Z","dependency_job_id":null,"html_url":"https://github.com/kitstack/async-job","commit_stats":null,"previous_names":["lab210-dev/async-job","lab210-dev/parallel","jackgianesini/async-job","kitstack/async-job"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/kitstack/async-job","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Fasync-job","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Fasync-job/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Fasync-job/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Fasync-job/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kitstack","download_url":"https://codeload.github.com/kitstack/async-job/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Fasync-job/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32038608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"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":["async","lightweight","queue","simple"],"created_at":"2024-05-01T19:12:07.097Z","updated_at":"2026-04-20T08:12:48.311Z","avatar_url":"https://github.com/kitstack.png","language":"Go","funding_links":[],"categories":["Goroutines"],"sub_categories":["检索及分析资料库"],"readme":"[![Go](https://github.com/lab210-dev/async-job/actions/workflows/go.yml/badge.svg)](https://github.com/lab210-dev/async-job/actions/workflows/go.yml)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/lab210-dev/async-job)\n[![Go Report Card](https://goreportcard.com/badge/github.com/lab210-dev/async-job)](https://goreportcard.com/report/github.com/lab210-dev/async-job)\n[![codecov](https://codecov.io/gh/lab210-dev/async-job/branch/main/graph/badge.svg?token=3JRL5ZLSIH)](https://codecov.io/gh/lab210-dev/async-job)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/lab210-dev/async-job/blob/main/LICENSE)\n# Overview\n\nAsyncJob is an asynchronous job manager with light code, clear and speed. I hope so ! 😬\n\n## Features\n\n- [x] AsyncJob is a simple asynchronous job manager.\n- [x] Full code coverage\n- [x] Async queue\n- [x] Define the number of asynchronous tasks (default: runtime.NumCPU())\n- [x] Handling of managed and unmanaged errors\n- [x] Provide a simple ETA\n- [x] Full code description\n\n### Usage\n\n```go\npackage main\n\nimport (\n\t\"github.com/lab210-dev/async-job\"\n\t\"log\"\n)\n\nfunc main() {\n\t// Create a new AsyncJob\n\tasj := asyncjob.New[string]()\n\n\t// Set the number of asynchronous tasks (default: runtime.NumCPU())\n\tasj.SetWorkers(2)\n\n\t// Listen to the progress status\n\tasj.OnProgress(func(progress asyncjob.Progress) {\n            log.Printf(\"Progress: %s\\n\", progress.String())\n\t})\n\n\t// Run all jobs \n\terr := asj.Run(func(job asyncjob.Job[string]) error {\n            // receive the job in job data function\n            // if err return or panic, the job will be marked as failed and all progress will be canceled\n            return nil\n\t}, []string{\"Hello\", \"World\"})\n\n\t// if a job returns an error, it stops the process\n\tif err != nil {\n            log.Fatal(err)\n\t}\n}\n```\n\n## 💡 For better performance\n\nUsing a modulo to reduce the eta display (fast example)\n\n```go\npackage main\n\nimport (\n\t\"github.com/lab210-dev/async-job\"\n\t\"log\"\n\t\"time\"\n)\n\nfunc main() {\n\t// create slice of jobs\n\tvar list []time.Duration\n\tfor i := 1; i \u003c= 100; i++ {\n\t\tlist = append(list, time.Duration(1)*time.Millisecond)\n\t}\n\terr := asyncjob.New[time.Duration]().\n\t\tSetWorkers(2).\n\t\tOnProgress(func(progress asyncjob.Progress) {\n\t\t\t// Eta will be displayed every 10 jobs\n\t\t\tif progress.Current()%10 != 0 {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// print the eta\n\t\t    log.Printf(\"Progress: %s\\n\", progress.String())\n\t\t}).\n\t\tRun(func(job asyncjob.Job[time.Duration]) error {\n\t\t\t// slow down the job\n\t\t\ttime.Sleep(job.Data())\n\t\t\treturn nil\n\t\t}, list)\n\t\n\t// if a job returns an error, it stops the process\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\n## 🤝 Contributions\nContributors to the package are encouraged to help improve the code.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitstack%2Fasync-job","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitstack%2Fasync-job","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitstack%2Fasync-job/lists"}