0

I'm using clj-statsd (from here) to send gauges to a StatsD server. When the program begins, I use (statsd/setup host port), but then the program will not exit when using lein run. Even running a simple (defn -main [] (statsd/setup host port)) will not exit. Any idea on how to shutdown the socket, or whatever is disturbing the program from ending?

shakedzy
  • 2,853
  • 5
  • 32
  • 62
  • this could help. Since it runs on jvm, all the java techniques are usable. http://stackoverflow.com/questions/22452930/terminating-a-java-program . simple `(System/exit 0)` probably will do – leetwinski Jul 21 '16 at 12:31
  • Yes, I was hoping there's a more subtle way to do this than terminating the process.. – shakedzy Jul 21 '16 at 13:10

1 Answers1

2

Since statsd uses agents, you probably just have to call shutdown-agents.

https://clojuredocs.org/clojure.core/shutdown-agents

Joost Diepenmaat
  • 17,633
  • 3
  • 44
  • 53