mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 08:50:57 -05:00
🐛 Fix awsns handler, convert it ot async
This commit is contained in:
parent
05c77d0248
commit
0416082d4d
1 changed files with 22 additions and 17 deletions
|
@ -26,25 +26,30 @@
|
||||||
|
|
||||||
(defmethod ig/init-key ::handler
|
(defmethod ig/init-key ::handler
|
||||||
[_ cfg]
|
[_ cfg]
|
||||||
(fn [request]
|
(fn [request respond raise]
|
||||||
(let [body (parse-json (slurp (:body request)))
|
(try
|
||||||
mtype (get body "Type")]
|
(let [body (parse-json (slurp (:body request)))
|
||||||
(cond
|
mtype (get body "Type")]
|
||||||
(= mtype "SubscriptionConfirmation")
|
(cond
|
||||||
(let [surl (get body "SubscribeURL")
|
(= mtype "SubscriptionConfirmation")
|
||||||
stopic (get body "TopicArn")]
|
(let [surl (get body "SubscribeURL")
|
||||||
(l/info :action "subscription received" :topic stopic :url surl)
|
stopic (get body "TopicArn")]
|
||||||
(http/send! {:uri surl :method :post :timeout 10000}))
|
(l/info :action "subscription received" :topic stopic :url surl)
|
||||||
|
(http/send! {:uri surl :method :post :timeout 10000}))
|
||||||
|
|
||||||
(= mtype "Notification")
|
(= mtype "Notification")
|
||||||
(when-let [message (parse-json (get body "Message"))]
|
(when-let [message (parse-json (get body "Message"))]
|
||||||
(let [notification (parse-notification cfg message)]
|
(let [notification (parse-notification cfg message)]
|
||||||
(process-report cfg notification)))
|
(process-report cfg notification)))
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(l/warn :hint "unexpected data received"
|
(l/warn :hint "unexpected data received"
|
||||||
:report (pr-str body)))
|
:report (pr-str body))))
|
||||||
{:status 200 :body ""})))
|
(catch Throwable cause
|
||||||
|
(l/error :hint "unexpected exception on awsns handler"
|
||||||
|
:cause cause)))
|
||||||
|
|
||||||
|
(respond {:status 200 :body ""})))
|
||||||
|
|
||||||
(defn- parse-bounce
|
(defn- parse-bounce
|
||||||
[data]
|
[data]
|
||||||
|
|
Loading…
Reference in a new issue