Simplify the system start and restart functions

This commit changes the binding name of system/start's argument to
_ (since it is currently not used within the function), and simplifies
the system/restart function by not swapping the system Var's content
with nil before filling it with the new-created system state.

Eventually, these changes will be reverted when the initialisation of
the system is separated from the starting of that system, which will
mean that system/start will read its argument and that system/restart
will have to reinitialise the system state before restarting it.

Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
This commit is contained in:
Sebastian Crane 2022-03-24 21:51:06 +00:00
parent fecd09c656
commit 91cbdb69da
1 changed files with 2 additions and 3 deletions

View File

@ -34,7 +34,7 @@
(yaml/parse-stream datafile))
(catch Exception e nil)))
(defn start [system]
(defn start [_]
(let [config (load-config "config.yaml")
state (atom (load-state (:data-file config)))
irc (irc/new-irc-connection state config)]
@ -52,8 +52,7 @@
(defn restart [system-var]
(do
(alter-var-root system-var stop)
(alter-var-root system-var (constantly nil))
(stop (deref system-var))
(alter-var-root system-var start)))
(defn -main [& args]