Scheduler.simple
A simple scheduler for Integrant
Install / Use
/learn @duct-framework/Scheduler.simpleREADME
Duct scheduler.simple 
Integrant methods for running functions periodically in a thread pool. Part of the Duct framework, but can be used in any application that uses Integrant.
Installation
Add the following dependency to your deps.edn file:
org.duct-framework/scheduler.simple {:mvn/version "0.2.1"}
Or to your Leiningen project file:
[org.duct-framework/server.http.jetty "0.2.1"]
Usage
The scheduler runs jobs, which are zero-argument functions, at periodic intervals. A configuration might look something like this:
{:duct.scheduler/simple
{:jobs [{:interval 60 :run #ig/ref :example.job/every-minute}
{:interval 3600 :run #ig/ref :example.job/every-hour]}
:example.job/every-minute {}
:example.job/every-hour {}}
Where the example jobs are defined:
(require '[integrant.core :as ig])
(defmethod ig/init-key :example.job/every-minute [_ _]
#(println "A minute passed."))
(defmethod ig/init-key :example.job/every-hour [_ _]
#(println "An hour passed."))
The :duct.schedule/simple key takes a collection of :jobs, and
optionally the :thread-pool-size, which defaults to 32.
Jobs are maps that have three keys:
:delay(optional) - how long in seconds to delay before the first job:interval- how long in seconds between the start of each job:run- a zero-argument function run at each interval
This scheduler isn't suitable for more complex cron-like scheduling, but is useful if you just want to periodically run cleanup, indexing or other processing scripts at regular intervals.
License
Copyright © 2025 James Reeves
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.
Related Skills
node-connect
351.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
