;; This Source Code Form is subject to the terms of the Mozilla Public ;; License, v. 2.0. If a copy of the MPL was not distributed with this ;; file, You can obtain one at http://mozilla.org/MPL/2.0/. ;; ;; Copyright (c) 2020 Andrey Antukh (ns app.util.async (:require [clojure.core.async :as a] [clojure.spec.alpha :as s]) (:import java.util.concurrent.Executor)) (defmacro go-try [& body] `(a/go (try ~@body (catch Exception e# e#)))) (defmacro !! c ret))) (finally (a/close! c))))) c (catch java.util.concurrent.RejectedExecutionException e (a/offer! c e) (a/close! c) c))))