Fork me on GitHub
#aws
<
2022-06-21
>
Dimitar Uzunov09:06:55

how do you use a waiter with https://github.com/cognitect-labs/aws-api? I.e. Iā€™m starting a cluster and I want to block the thread until it is done starting?

jjttjj12:06:41

I don't think this is fully intended to be used like this, but you can use the async version of the api's invoke along with :retriable to check if your thing is ready

(a/<!!
  (aaws/invoke cfn
    {:op         <describe resources>
     :request    <request  for resource info>
     :retriable? (fn [result] <truthy when resource is ready>)
     :backoff    (fn [x]
                   (println "retry" (str "#" x))
                   (cond
                     (zero? x) 60000
                     (< x 20)  10000))}))

šŸ‘ 1
Dimitar Uzunov13:06:05

yep that looks quite useful, I was just wondering what is the recommended way

jjttjj13:06:46

You could always just do the polling manually in a normal loop also

jjttjj13:06:21

Here's a bit more info why I don't think the :retriable thing is offically supported (I could be wrong) https://clojurians.slack.com/archives/C09N0H1RB/p1652101946639159

šŸ‘ 1
ghadi15:06:45

that's not what retriable is for

ghadi15:06:18

retriable is for failures, not stuff like status transitions from IN_PROGRESS -> READY

ghadi16:06:53

probably could use an issue for adding Waiters to aws-api