diff --git a/deploy.sh b/deploy.sh index e6e200a..a5f2a26 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,5 +1,9 @@ #!/bin/sh +set -e + export AWS_PROFILE=personal -docker buildx build --platform linux/amd64,linux/arm64 -t 853019563312.dkr.ecr.eu-central-1.amazonaws.com/micro-blog-fetchers-homelabstack:latest --push . \ No newline at end of file +docker buildx build --platform linux/amd64,linux/arm64 -t 853019563312.dkr.ecr.eu-central-1.amazonaws.com/micro-blog-fetchers-homelabstack:latest --push . + +echo "Image pushed to ECR" diff --git a/src/micro_blog/nostr.clj b/src/micro_blog/nostr.clj index 1aecdc5..3e751fa 100644 --- a/src/micro_blog/nostr.clj +++ b/src/micro_blog/nostr.clj @@ -53,6 +53,7 @@ pb/save-post))))) (def socket (atom nil)) +(declare start) (defn connect [] (tel/log! :info "Opening websocket connection to nostr relay") (reset! socket @(ws/websocket (@config :nostr-relay) @@ -60,7 +61,11 @@ :on-message (fn [_ws msg _last?] (process-msg msg)) :on-close (fn [_ws status reason] - (tel/log! {:level :warn :data {:status status :reason reason}} "WebSocket connection closed"))}))) + (tel/log! {:level :warn :data {:status status :reason reason}} "WebSocket connection closed") + (future + (Thread/sleep (* 5 60 1000)) + (tel/log! :info "Reconnecting WebSocket") + (start)))}))) (defn subscribe-to-author [pubkey since] (let [sub-id (@config :nostr-fetcher-id)