Skip to content

Commit

Permalink
Merge pull request #120 from keboola/kacurez-patch-1
Browse files Browse the repository at this point in the history
increase max wait time for async ads insights to 10 hours
  • Loading branch information
kacurez authored Jun 24, 2024
2 parents 572b8e0 + c9e4c70 commit 8fa04ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/keboola/facebook/api/exponential_backoff.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

(def time-slot-ms 100)
(def truncate 5)
(def MAX_WAIT_TIME (* 1000 60 60 2))
(def MAX_WAIT_TIME (* 1000 60 60 10))

(defn with-exp-backoff [action!]
(loop [c 0
waited 0]
(let [slot (* time-slot-ms (dec (Math/pow 2 c)))]
(when (> waited MAX_WAIT_TIME)
(runtime/user-error "Polling timeout exceeded:" waited))
(runtime/user-error (str "Polling timeout exceeded:" waited)))
(Thread/sleep slot)
(when (not (action!))
(recur (if (>= c truncate) c (inc c)) (+ waited slot))))))
Expand Down

0 comments on commit 8fa04ab

Please sign in to comment.