{"id":44457667,"url":"https://github.com/justpresident/schedly","last_synced_at":"2026-02-12T18:07:40.184Z","repository":{"id":57524678,"uuid":"254680438","full_name":"justpresident/schedly","owner":"justpresident","description":"Flexible task scheduling library for Golang applications with no dependencies","archived":false,"fork":false,"pushed_at":"2023-01-02T17:50:12.000Z","size":36,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T15:54:35.350Z","etag":null,"topics":["golang","scheduler","scheduler-cron","scheduler-framework","scheduler-library"],"latest_commit_sha":null,"homepage":"","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/justpresident.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-10T16:17:37.000Z","updated_at":"2024-06-20T15:54:35.351Z","dependencies_parsed_at":"2023-02-01T03:45:43.634Z","dependency_job_id":null,"html_url":"https://github.com/justpresident/schedly","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/justpresident/schedly","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justpresident%2Fschedly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justpresident%2Fschedly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justpresident%2Fschedly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justpresident%2Fschedly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justpresident","download_url":"https://codeload.github.com/justpresident/schedly/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justpresident%2Fschedly/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29375722,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"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":["golang","scheduler","scheduler-cron","scheduler-framework","scheduler-library"],"created_at":"2026-02-12T18:07:39.500Z","updated_at":"2026-02-12T18:07:40.176Z","avatar_url":"https://github.com/justpresident.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Schedly: A job scheduling library for Golang applications\n![Go Test](https://github.com/justpresident/schedly/workflows/Go%20Test/badge.svg?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/justpresident/schedly)](https://goreportcard.com/report/github.com/justpresident/schedly) [![GoDoc Widget]][GoDoc]\n\n## What is it?\n\nVery light weight and flexible task scheduling library for Golang applications without extra dependencies.\n\n## Usage\n\n### Install\n```bash\ngo get github.com/justpresident/schedly\n```\n\n### Examples\n```go\npackage main\n\nimport (\n\n\"fmt\"\n\"github.com/justpresident/schedly\"\n\"time\"\n\n)\n\nfunc main() {\n  // Create a scheduler with a tick = second\n  sched := schedly.NewScheduler(time.Second).\n    SetAligned(true) // start launching tasks at the beginning of their period - e.g.\n                     // minutely tasks at the beginning of every minute.\n  \n   // Print current time every 5 seconds\n  sched.Schedule(5*time.Second, \"print time\", func() {fmt.Print(time.Now())})\n\n  sched.Start()\n\n  sched.WaitUntilStopped() // to wait indefinitely until program exits or someone calls Stop()\n}\n```\nschedly doesn't take any assumptions and allows you to implement any schedule easily.\n\nLet's define a schedule for our job - every minute of NASDAQ trading time.\n```go\n  nasdaqTimeSchedule := sched.NewSchedule(time.Minute). // execute tasks minutely\n\tSetConstraintFunc(isNasdaqTime) // where isNasdaqTime := func(moment time.Time) bool {...} \n  \n  sched.AddJob(\n    nasdaqTimeSchedule,\n    \"download TSLA stock price\",\n    func() { updateQuote(\"TSLA\") },\n  )\n```\n\nTo stop scheduler from running new tasks:\n```go\n  ... // do whatever your application needs to do and then call\n  sched.Stop() // to stop scheduling new tasks\n  // and optionally\n  sched.WaitForRunningTasks() // to gracefully wait for all the running tasks to finish\n```\n\n### Schedule\nSchedule have following configuration options:\n\n**SetConstraintFunc()** to set up an extra constraint. Example:\n```go\nsched.NewSchedule(time.Minute).\n  SetConstraintFunc(func (t time.Time) {\n    return t.Weekday() != time.Sunday\n  })\n```\n**SetAligned(true)** to set up aligned feature of the schedule.\nIt is automatically set to true if Aligned property has already been set for scheduler itself. You can enable/disable this property individually per job.\n\nSchedule has following accessors:\n```go\nschedule.IntervalMode() // returns interval mode setting (read above)\nschedule.Aligned() // returns aligned setting (read above)\nschedule.Every() // returns launch interval\n```\n\n**SetIntervalMode()** When IntervalMode is set to `false` then next job launch time is calculated as 'last job start time' + configured interval.\nWhen set to `true` the interval for launching the job is measured from the finish time of previous launch.\n### Jobs\nThe job returned by `AddJob` or `Schedule` methods can be further configured:\n```go\nmyJob := sched.Schedule(5*time.Second, \"print time\", func() {fmt.Print(time.Now())})\n\n/* Avoid parallel runs. If previous run of the job has not finished yet,\n next run will be blocked until it finishes. It simply locks a mutex before starting.\nMore options of controlling this behaviour will be introduced in next releases.\n*/ \nmyJob.SetExclusive(true)\n\n// You don't need to assign a job to a variable to configure it. You can do it in one line:\nsched.Schedule(...).SetExclusive(true)\n```\n\nAlso job has following accessors:\n```go\nmyJob.Name() // returns the name of the job\nmyJob.LastRun() // returns previous start time. Returns 0 if the job has not been launched yet\nmyJob.LastFinish() // returns finish time of previous launch. Returns 0 if job has not been launched yet or has not finished yet.\nmyJob.Exclusive() // returns exclusive launch setting (read above)\n```\n\n## How to contribute\nPlease refer to the contribution guidelines here: [/docs/CONTRIBUTING.md](/docs/CONTRIBUTING.md)\n\n[GoDoc]: https://pkg.go.dev/github.com/justpresident/schedly\n[GoDoc Widget]: https://img.shields.io/badge/godoc-reference-007d9c?logo=go\u0026logoColor=white\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustpresident%2Fschedly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustpresident%2Fschedly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustpresident%2Fschedly/lists"}