add mastodon cron

This commit is contained in:
Travis Shears 2025-08-04 10:10:53 +02:00
parent 6249124c17
commit ded5314125
2 changed files with 13 additions and 7 deletions

View file

@ -11,7 +11,7 @@ instance.
- [x] BlueSky
- [ ] Pixelfed
- [ ] Mastodon
- [x] Mastodon
- [ ] Nostr
@ -33,7 +33,7 @@ $ java -jar ./target/micro-blog-standalone.jar
Build new docker image and push it to ECR
```shell
$ docker buildx build --platform linux/amd64,linux/arm64 -t 853019563312.dkr.ecr.eu-central-1.amazonaws.com/micro-blog-fetchers:2.0.1 --push .
$ docker buildx build --platform linux/amd64,linux/arm64 -t 853019563312.dkr.ecr.eu-central-1.amazonaws.com/micro-blog-fetchers-homelabstack:latest --push .
```
## Project history
@ -44,3 +44,4 @@ $ docker buildx build --platform linux/amd64,linux/arm64 -t 853019563312.dkr.ec
cluster running I'm switching most of my personal apps to on-prem. Pocketbase instance is already running on-prem.
For this app I swap Serverless for docker container. App now deployed on-prem and the docker containers run once per hour
thanks to Nomad's job scheduling.
- July 2025: Start rewrite in Clojure with a long running docker container deployment instead of scheduled runs.

View file

@ -3,12 +3,17 @@
(:import [java.time Instant Duration])
(:require [chime.core :as chime]
[taoensso.telemere :as tel]
[micro-blog.blue-sky :as blue-sky]))
[micro-blog.blue-sky :as blue-sky]
[micro-blog.mastodon :as masto]))
(def crons [blue-sky/run
masto/run])
(defn -main []
(tel/log! :info "Setting up crons")
(chime/chime-at (chime/periodic-seq (Instant/now) (Duration/ofMinutes 30))
(fn [_time]
(blue-sky/run)))
(doseq [[i cron] (map-indexed vector crons)]
(let [start (.plus (Instant/now) (Duration/ofMinutes (* i 5)))]
(chime/chime-at (chime/periodic-seq start (Duration/ofMinutes 30))
(fn [_time]
(cron)))))
@(promise))