This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-24
Channels
- # admin-announcements (1)
- # aleph (3)
- # announcements (4)
- # beginners (30)
- # boot (296)
- # cider (21)
- # cljsjs (2)
- # cljsrn (18)
- # clojure (124)
- # clojure-poland (23)
- # clojure-russia (4)
- # clojurescript (73)
- # core-async (58)
- # css (3)
- # datomic (31)
- # editors (4)
- # emacs (35)
- # euroclojure (3)
- # hoplon (104)
- # immutant (8)
- # jobs (3)
- # jobs-discuss (1)
- # keechma (1)
- # ldnclj (33)
- # leiningen (5)
- # liberator (1)
- # mount (20)
- # off-topic (2)
- # om (104)
- # onyx (54)
- # parinfer (80)
- # proton (1)
- # re-frame (59)
- # remote-jobs (1)
- # ring-swagger (9)
- # slack-help (15)
- # spacemacs (7)
- # yada (12)
So I’m not sure if this is a reasonable question or not… but has anyone dealt with the case where a defstate fails to start? In my case it might be totally reasonable for a thing to not start, in which case I just don’t want to use it, but there might be other cases where the entire app should stop. Has anyone else thought about/dealt with this stuff?
@lfn3: say we have 3 states A
, B
and a C
. on (mount/start)
, B
failed to start. Are you saying in some case it is ok to ignore this fact, and just use an application with just A
and C
?
@tolitius: Yeah that’s correct, but some functionality should be disabled when B
fails to start.
@tolitius: Seems like the behaviour should be transitive, right? If B
fails then C
should also fail.
if you don't need the state that could fail (and app is ok with it), can't you just start with "(start-without B
)"?
Agreed, but I’m thinking more if B
fails to start and C
uses B
in it’s :start method then transitive-ness will be handled 'auto-magically'.
The thing is we’d like to try and start with B
but if it fails, that’s fine, we just want to have that affect other parts of the application (change routing, for instance)
if B
is ok to fail, could it then program this behavior in its start method?
(defn start-b []
(try ...
(catch Throwable t
:dafault-b-value)))
(defstate b :start (start-b))
unless you can't really start without B
because C
depends on it... then:
(mount/start-without "B" "C")
(mount/start)