Updated deps
This commit is contained in:
parent
7359e4570b
commit
f0d8f59cc1
|
@ -11,16 +11,16 @@
|
||||||
{
|
{
|
||||||
"lib": "org.fudo/milquetoast",
|
"lib": "org.fudo/milquetoast",
|
||||||
"url": "https://git.fudo.org/fudo-public/milquetoast.git",
|
"url": "https://git.fudo.org/fudo-public/milquetoast.git",
|
||||||
"rev": "8f71590fd8d63a0a7ab45a46ae6a7a1eee99f16f",
|
"rev": "6c64dedc17f506f3190207bbe08eb1eb1edc7e01",
|
||||||
"git-dir": "https/git.fudo.org/fudo-public/milquetoast",
|
"git-dir": "https/git.fudo.org/fudo-public/milquetoast",
|
||||||
"hash": "sha256-DpaqFv4HwEncDjkD3wQHMB50MmWMR6Z42+j5itGdT44="
|
"hash": "sha256-46iTmkDHpoPuuN4cxIDL1pIKjyKfAF5/tUlz4ixLsbs="
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"lib": "org.fudo/objectifier-client",
|
"lib": "org.fudo/objectifier-client",
|
||||||
"url": "https://git.fudo.org/fudo-public/objectifier-client.git",
|
"url": "https://git.fudo.org/fudo-public/objectifier-client.git",
|
||||||
"rev": "d4b5ecc0f98aa8168ca3ef13e182c688591298ae",
|
"rev": "3b2bcd702f41f77625bc4dfb47f53a8b1507cd4c",
|
||||||
"git-dir": "https/git.fudo.org/fudo-public/objectifier-client",
|
"git-dir": "https/git.fudo.org/fudo-public/objectifier-client",
|
||||||
"hash": "sha256-WVFG9yCKawBrEpNS0Bfdy+W3S5dBvlwJcfdMNJ1/rVM="
|
"hash": "sha256-MEjkPFCjgUSgVSkxWqJ0hcrnFwe2dYSTAKKCFoRHyos="
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"mvn-deps": [
|
"mvn-deps": [
|
||||||
|
|
4
deps.edn
4
deps.edn
|
@ -14,11 +14,11 @@
|
||||||
}
|
}
|
||||||
org.fudo/objectifier-client {
|
org.fudo/objectifier-client {
|
||||||
:git/url "https://git.fudo.org/fudo-public/objectifier-client.git"
|
:git/url "https://git.fudo.org/fudo-public/objectifier-client.git"
|
||||||
:git/sha "d4b5ecc0f98aa8168ca3ef13e182c688591298ae"
|
:git/sha "3b2bcd702f41f77625bc4dfb47f53a8b1507cd4c"
|
||||||
}
|
}
|
||||||
org.fudo/milquetoast {
|
org.fudo/milquetoast {
|
||||||
:git/url "https://git.fudo.org/fudo-public/milquetoast.git"
|
:git/url "https://git.fudo.org/fudo-public/milquetoast.git"
|
||||||
:git/sha "8f71590fd8d63a0a7ab45a46ae6a7a1eee99f16f"
|
:git/sha "6c64dedc17f506f3190207bbe08eb1eb1edc7e01"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
systemd.services.suanni-server = {
|
systemd.services.suanni-server = {
|
||||||
path = [ suanni-server ];
|
path = [ suanni-server ];
|
||||||
wantedBy = [ "default.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "network-online.target" ];
|
after = [ "network-online.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
[suanni.stoppable :refer [IStoppable stop!]]
|
[suanni.stoppable :refer [IStoppable stop!]]
|
||||||
[milquetoast.client :as mqtt]
|
[milquetoast.client :as mqtt]
|
||||||
[objectifier-client.core :as obj]
|
[objectifier-client.core :as obj]
|
||||||
[clojure.core.async :as async :refer [<! >! go-loop]]
|
[clojure.core.async :as async :refer [<! >! go-loop <!! timeout]]
|
||||||
[clojure.string :as str])
|
[clojure.string :as str])
|
||||||
(:import java.time.Instant))
|
(:import java.time.Instant))
|
||||||
|
|
||||||
|
@ -29,6 +29,24 @@
|
||||||
ISuanNiServer
|
ISuanNiServer
|
||||||
(object-channel [_] obj-chan))
|
(object-channel [_] obj-chan))
|
||||||
|
|
||||||
|
(defn- retry-attempt [verbose f]
|
||||||
|
(let [wrap-attempt (fn []
|
||||||
|
(try [true (f)]
|
||||||
|
(catch RuntimeException e
|
||||||
|
(do (when verbose
|
||||||
|
(println (format "exception: %s"
|
||||||
|
(.toString e))))
|
||||||
|
[false e]))))
|
||||||
|
max-wait (* 5 60 1000)] ;; wait at most 5 minutes
|
||||||
|
(loop [[success? result] (wrap-attempt)
|
||||||
|
wait-ms 1000]
|
||||||
|
(if success?
|
||||||
|
result
|
||||||
|
(do (when verbose
|
||||||
|
(println (format "attempt failed, sleeping %s ms" wait-ms)))
|
||||||
|
(<!! (timeout wait-ms))
|
||||||
|
(recur (wrap-attempt) (min (* wait-ms 1.25) max-wait)))))))
|
||||||
|
|
||||||
(defn start!
|
(defn start!
|
||||||
[& {:keys [listen-host
|
[& {:keys [listen-host
|
||||||
listen-port
|
listen-port
|
||||||
|
@ -69,7 +87,8 @@
|
||||||
(println "stopping image listener")
|
(println "stopping image listener")
|
||||||
(async/close! obj-chan))
|
(async/close! obj-chan))
|
||||||
(let [{:keys [location camera-id snapshot time]} image-data
|
(let [{:keys [location camera-id snapshot time]} image-data
|
||||||
summary (obj/get-summary! obj-client snapshot)]
|
summary (retry-attempt verbose
|
||||||
|
#(obj/get-summary! obj-client snapshot))]
|
||||||
(when verbose
|
(when verbose
|
||||||
(println (str "detected "
|
(println (str "detected "
|
||||||
(count (:objects summary))
|
(count (:objects summary))
|
||||||
|
|
Loading…
Reference in New Issue