{"id":19336954,"url":"https://github.com/eddort/scheduler","last_synced_at":"2026-06-18T11:31:46.906Z","repository":{"id":150026972,"uuid":"622619154","full_name":"eddort/scheduler","owner":"eddort","description":"a simple, concurrent task scheduler written in Go","archived":false,"fork":false,"pushed_at":"2023-05-01T20:45:14.000Z","size":15,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T08:13:57.503Z","etag":null,"topics":["go","go-scheduler","golang","golang-library","golang-package"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eddort.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-04-02T16:36:22.000Z","updated_at":"2023-06-18T10:44:26.000Z","dependencies_parsed_at":"2024-03-14T12:47:17.376Z","dependency_job_id":null,"html_url":"https://github.com/eddort/scheduler","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/eddort/scheduler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddort%2Fscheduler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddort%2Fscheduler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddort%2Fscheduler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddort%2Fscheduler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eddort","download_url":"https://codeload.github.com/eddort/scheduler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddort%2Fscheduler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34489019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"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":["go","go-scheduler","golang","golang-library","golang-package"],"created_at":"2024-11-10T03:13:00.893Z","updated_at":"2026-06-18T11:31:46.888Z","avatar_url":"https://github.com/eddort.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Scheduler\n\nA simple, concurrent task scheduler written in Go.\n\n## Features\n\n- Register tasks with unique names, intervals, and deadlines\n- Concurrently execute tasks in separate goroutines\n- Automatically prevent multiple instances of the same task from running simultaneously\n- Gracefully handle task deadlines with context cancellation\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/eddort/scheduler\"\n)\n\nfunc main() {\n\n\tcounter := 0\n\n\tregistry := scheduler.New()\n\n\ttaskConfig := scheduler.TaskConfig{\n\t\tName:     \"PrintTime\",\n\t\tInterval: 2 * time.Second,\n\t\tDeadline: 3 * time.Second,\n\t\tAction: func(payload scheduler.Payload) error {\n\t\t\tfmt.Println(\"Current time:\", time.Now())\n\t\t\ttime.Sleep(1 * time.Second)\n\t\t\tif counter%2 == 0 {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn errors.New(\"what's up\")\n\t\t},\n\t\tMiddlewares: []scheduler.Middleware{func(next scheduler.ActionFunc) scheduler.ActionFunc {\n\t\t\treturn func(payload scheduler.Payload) error {\n\t\t\t\tcounter++\n\n\t\t\t\tfmt.Println(\"Before task execution:\", payload.Name)\n\n\t\t\t\terr := next(payload)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(\"Task finished with an error:\", err)\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println(\"Task finished correctly\")\n\t\t\t\t}\n\n\t\t\t\treturn err\n\t\t\t}\n\t\t}},\n\t}\n\n\t// Register and start the task\n\tregistry.RegisterTask(taskConfig)\n\tgo func() {\n\t\ttime.Sleep(20 * time.Second)\n\t\tregistry.Stop()\n\t}()\n\tregistry.Start()\n}\n\n```\n\n## Installation\n\n```bash\ngo get -u github.com/eddort/scheduler\n```\n\n## Testing\n\nWe use the [testify](https://github.com/stretchr/testify) library for testing. Install it with:\n\n```bash\ngo get -u github.com/stretchr/testify\n```\n\nThen run tests with:\n\n```bash\ngo test\n```\n\n## License\n\nThis project is licensed under the MIT License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddort%2Fscheduler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddort%2Fscheduler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddort%2Fscheduler/lists"}