{"id":38836022,"url":"https://github.com/monime-lab/gotasks","last_synced_at":"2026-01-17T13:56:06.173Z","repository":{"id":57691815,"uuid":"480062857","full_name":"monime-lab/gotasks","owner":"monime-lab","description":"A production inspired task parallelization library","archived":false,"fork":false,"pushed_at":"2025-05-02T12:27:35.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-02T13:37:57.079Z","etag":null,"topics":["go","go-concurrency","go-task","golang","monime","task-parallelism","task-runner"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/monime-lab.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":"2022-04-10T15:44:28.000Z","updated_at":"2025-05-02T12:27:39.000Z","dependencies_parsed_at":"2023-10-16T23:18:36.094Z","dependency_job_id":"a2aacab8-65e5-4fac-851e-e2f42c4c3bc6","html_url":"https://github.com/monime-lab/gotasks","commit_stats":null,"previous_names":["piehlabs/goconc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/monime-lab/gotasks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monime-lab%2Fgotasks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monime-lab%2Fgotasks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monime-lab%2Fgotasks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monime-lab%2Fgotasks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/monime-lab","download_url":"https://codeload.github.com/monime-lab/gotasks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/monime-lab%2Fgotasks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28509585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["go","go-concurrency","go-task","golang","monime","task-parallelism","task-runner"],"created_at":"2026-01-17T13:56:06.073Z","updated_at":"2026-01-17T13:56:06.158Z","avatar_url":"https://github.com/monime-lab.png","language":"Go","readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/monime-lab/gotasks)](https://goreportcard.com/report/github.com/monime-lab/gotasks)\n[![LICENSE](https://img.shields.io/badge/License-Apache%202-blue.svg)](https://github.com/monime-lab/gotasks/blob/main/LICENSE)\n\n# gotasks\n\nA production inspired task parallelization library\n\n### Install\n\n```bash\ngo get -u github.com/monime-lab/gotasks\n```\n\n### Sample\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"github.com/monime-lab/gotasks\"\n\t\"github.com/monime-lab/gotries\"\n\t\"log\"\n\t\"time\"\n)\n\nfunc saveToStore1() error {\n\treturn nil\n}\n\nfunc saveToStore2() error {\n\treturn nil\n}\n\nfunc getUserByID(id int) (interface{}, error) {\n\treturn fmt.Sprintf(\"user-%d\", id), nil\n}\n\nfunc main() {\n\trunnerExampleOne()\n\trunnerExampleTwo()\n\tschedulerExampleOne()\n\tschedulerExampleTwo()\n}\n\nfunc runnerExampleOne() {\n\t_, err := gotasks.NewTaskRunner( /* Options here... */).\n\t\tAddRunnableTask(func(ctx context.Context) error {\n\t\t\treturn saveToStore1()\n\t\t}).\n\t\tAddRunnableTask(func(ctx context.Context) error {\n\t\t\treturn saveToStore2()\n\t\t}).RunAndWaitAny(context.TODO())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tlog.Printf(\"At least one of them succeeds!!!\")\n}\n\nfunc runnerExampleTwo() {\n\trunner := gotasks.NewTaskRunner(\n\t\t// This is a fail fast switch useful\n\t\t// when calling runner.RunAndWaitAll()\n\t\t// The call will return on the first failure\n\t\tgotasks.WithEagerFail(true),\n\t\t// The maximum parallelism. This is a\n\t\t// concurrency rate-limiter for when\n\t\t// the number of tasks can be high.\n\t\t// At any point, there are at most `max`\n\t\t// task (goroutines) running concurrently.\n\t\t// Value \u003c 1 means unbounded parallelism\n\t\tgotasks.WithMaxParallelism(10),\n\t\t// Syntactic sugar to WithMaxParallelism(1).\n\t\t// Useful for executing multiple tasks serially\n\t\tgotasks.WithSequentialParallelism(),\n\t\t// Default retry options for all the added tasks\n\t\tgotasks.WithRetryOptions(\n\t\t\t// Retry all tasks twice...\n\t\t\tgotries.WithMaxAttempts(2),\n\t\t),\n\t)\n\tfor i := 1; i \u003c= 5; i++ {\n\t\tfunc(id int) {\n\t\t\trunner.AddCallableTask(func(ctx context.Context) (interface{}, error) {\n\t\t\t\treturn getUserByID(id)\n\t\t\t}, gotries.WithTaskName(fmt.Sprintf(\"RunnerTask-%d\", i)))\n\t\t}(i)\n\t}\n\tusers, err := runner.RunAndWaitAll(context.TODO())\n\tif err != nil {\n\t\t// The error(s) are composed using https://github.com/uber-go/multierr\n\t\tlog.Fatalf(\"At least one failed. Error: %s\", err)\n\t}\n\tlog.Printf(\"Users: %s\", users)\n}\n\nfunc schedulerExampleOne() {\n\t_ = gotasks.DefaultScheduler().Schedule(context.Background(), func(ctx context.Context) error {\n\t\tprintln(\"Printed after 1 second\")\n\t\treturn nil\n\t}, 1*time.Second)\n\t_ = gotasks.DefaultScheduler().Schedule(context.Background(), func(ctx context.Context) error {\n\t\tprintln(\"Printed after 2 seconds\")\n\t\treturn nil\n\t}, 2*time.Second)\n\tfuture3 := gotasks.DefaultScheduler().Schedule(context.Background(), func(ctx context.Context) error {\n\t\tprintln(\"Printed after 5 seconds\")\n\t\treturn errors.New(\"error after printing: 'Printed after 5 seconds\")\n\t}, 5*time.Second)\n\tif err := future3.Wait(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n\nfunc schedulerExampleTwo() {\n\tfuture := gotasks.DefaultScheduler().ScheduleAtFixedRate(context.Background(), func(ctx context.Context) error {\n\t\tfmt.Printf(\"Running at: %s\\n\", time.Now().Format(time.RFC3339))\n\t\treturn errors.New(\"oops!!! What's wrong\")\n\t}, 0, 1*time.Second)\n\tgo func() {\n\t\ttime.Sleep(10 * time.Second)\n\t\tprintln(\"Stopping the scheduled action\")\n\t\tfuture.Cancel()\n\t}()\n\terr := future.Wait()\n\tlog.Printf(\":::::::::::::::::::: Stopped. Err: %v\", err)\n}\n\n```\n\n## Contribute\n\nFor issues, comments, recommendation or feedback please [do it here](https://github.com/monime-lab/gotries/issues).\n\nContributions are highly welcome.\n\n:thumbsup:\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonime-lab%2Fgotasks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmonime-lab%2Fgotasks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmonime-lab%2Fgotasks/lists"}