This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-17
Channels
- # announcements (2)
- # aws (4)
- # babashka (20)
- # beginners (256)
- # calva (15)
- # chlorine-clover (1)
- # cider (12)
- # clj-kondo (25)
- # cljsrn (16)
- # clojure (115)
- # clojure-europe (7)
- # clojure-finland (5)
- # clojure-italy (10)
- # clojure-nl (35)
- # clojure-spec (13)
- # clojure-uk (83)
- # clojurescript (42)
- # code-reviews (81)
- # conjure (8)
- # cursive (6)
- # data-science (1)
- # datomic (3)
- # duct (18)
- # emacs (2)
- # figwheel-main (40)
- # fulcro (21)
- # helix (1)
- # jackdaw (7)
- # java (2)
- # lein-figwheel (5)
- # luminus (1)
- # observability (12)
- # off-topic (32)
- # parinfer (5)
- # pedestal (19)
- # re-frame (5)
- # reagent (8)
- # reitit (17)
- # rewrite-clj (47)
- # rum (19)
- # shadow-cljs (48)
- # spacemacs (4)
- # sql (40)
- # tools-deps (22)
- # vrac (1)
- # xtdb (25)
In my app I want to execute some code after the system has been initiated successfully. What is the proper way of doing this?
Generally speaking, after initialization, code will be executed by HTTP requests / cron tasks
I want to run a setup script for my web app (create stuff that have to be there etc). The script will be idempotent so I would not care if it runs after every system initialization
@kevin.van.rooijen in the main thread is right; there’s no such mechanism. Instead you need to use dependencies between components to force an ordering…
{ :my/database { ,,, }
:my/initialised-database { :db #ig/ref :my/database }
:my/app {:db #ig/ref :my/initialised-database}}
Ok, I don't think there's really a reason everything needs to be started, right? As long as the database connection is established. You could create an init-key that references :duct.database/sql
, and does what it needs to do
Ok so this is what my initial thought was, I asked to see if there is something like a callback to a successful initialization or smth
Thanks a lot @kevin.van.rooijen
https://github.com/duct-framework/core/blob/master/src/duct/core.clj#L213-L233 looks like exec-config
just starts the system and checks of there are any :duct/daemon
keys. If there are, it adds a shutdown hook and blocks infinitely