{"id":26956286,"url":"https://github.com/chorin1/dt-dt","last_synced_at":"2025-08-01T03:07:55.262Z","repository":{"id":65350789,"uuid":"257982138","full_name":"chorin1/dt-dt","owner":"chorin1","description":"Do this Do that - A clojure function scheduler","archived":false,"fork":false,"pushed_at":"2022-03-04T18:21:18.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-15T01:29:44.512Z","etag":null,"topics":["clojure","task-scheduler"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chorin1.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":"2020-04-22T18:10:14.000Z","updated_at":"2022-03-04T18:27:50.000Z","dependencies_parsed_at":"2023-01-19T05:15:27.222Z","dependency_job_id":null,"html_url":"https://github.com/chorin1/dt-dt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chorin1/dt-dt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chorin1%2Fdt-dt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chorin1%2Fdt-dt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chorin1%2Fdt-dt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chorin1%2Fdt-dt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chorin1","download_url":"https://codeload.github.com/chorin1/dt-dt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chorin1%2Fdt-dt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268162398,"owners_count":24205702,"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-08-01T02:00:08.611Z","response_time":67,"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":["clojure","task-scheduler"],"created_at":"2025-04-03T03:21:09.577Z","updated_at":"2025-08-01T03:07:55.231Z","avatar_url":"https://github.com/chorin1.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Do this Do that\nA lightweight \u0026 effective Clojure periodic task dispatcher.\n\u003cbr\u003e\u003cbr\u003e\n## Why?\nInspired by the simplicity of [at-at](https://github.com/overtone/at-at) this library was created to address some of its issues:\n* Dependency on clojure 1.3.0\n* Reflection\n* Silent error swallowing\n* ScheduledThreadPoolExecutor which is suited for more heavy-duty tasks\n\nSome of the other available Clojure libraries didn't quite fit, they either:\n* Require java interop usage\n* Depend on the core.async thread pool\n* Bloatware\n\u003cbr\u003e\u003cbr\u003e\n## Setup\nAdd the following to `project.clj` dependencies:\n```\n[dtdt \"0.2.0\"]\n```\n\n## Usage\nCreate a timer - each timer contains a single thread to run tasks.\n```clojure\n(def t (create-timer))\n```\nNext, assign a task to the timer. Task will start running periodically right away.\n```clojure\n(def some-task (every t 5000 #(println \"Hello there..\")))\n=\u003e #'dtdt.core/some-task\nHello there..\nHello there..\n...\n```\n\nAssign as many tasks as you wish to a timer, make sure each function's execution is short to prevent hogging the Timer's thread.\n\u003cbr\u003e\u003cbr\u003e\nTasks are cancellable.\n```clojure\nHello there..\nHello there..\n(cancel some-task)\n=\u003e true\n```\nNotes:\n* Timers can also be cancelled using the same `cancel` function.\n* Canceling a timer will cancel all of its running tasks.\n\n#### Initial delay\nBy default, new tasks will execute immediately. Optionally, you may pass an initial delay (or even a Date).\n```clojure\n; will execute f after 5 seconds and then every 10 milliseconds\n(every t 10 f 5000)\n```\n\n#### last execution time\nReturn the last execution time of a task in epoch-time.\n```clojure\n(last-execution-time task)\n=\u003e 1601223864378\n```\n\n### One-off\nExecute a task in X milliseconds from now.\n```clojure\n(in t 100 #(println \"you will see me only once!\"))\n```\n\n\n### Exceptions\nWhen an exception from a task is thrown it will be printed.\n```clojure\n(def bad-task (every t 5000 #(throw (Exception. \"Something is broken\"))))\ncaught exception in dtdt: Something is broken\n=\u003e #'dtdt.core/bad-task1\ncaught exception in dtdt: Something is broken\ncaught exception in dtdt: Something is broken\n```\n\nOptionally, pass an exception handler to alter the default behaviour.\n```clojure\n(let [task #(throw (Exception. \"Something broke again\"))\n      ex-handler (fn [e] (log/error (.getMessage e)))] \n  (every t 2000 task 0 ex-handler))\n```\n\n\u003cbr\u003e\u003cbr\u003e\n\n## License\n\nCopyright © 2020\u003cbr\u003e\nDistributed under the Eclipse Public License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchorin1%2Fdt-dt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchorin1%2Fdt-dt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchorin1%2Fdt-dt/lists"}