mirror of
https://github.com/penpot/penpot.git
synced 2025-03-15 17:21:17 -05:00
🚧 Minor changes on blocking calls for thumbnails generation.
This commit is contained in:
parent
aaa8bfe67d
commit
bfe6b98ee1
2 changed files with 27 additions and 1 deletions
|
@ -39,7 +39,9 @@
|
|||
[rows]
|
||||
(if (empty? rows)
|
||||
rows
|
||||
(p/all (map populate-thumbnail rows))))
|
||||
(vc/blocking
|
||||
(mapv (fn [row]
|
||||
(images/populate-thumbnail row +thumbnail-options+)) rows))))
|
||||
|
||||
(defn populate-urls
|
||||
[row]
|
||||
|
|
24
backend/vendor/vertx/src/vertx/core.clj
vendored
24
backend/vendor/vertx/src/vertx/core.clj
vendored
|
@ -57,6 +57,30 @@
|
|||
[]
|
||||
(Vertx/currentContext))
|
||||
|
||||
(defmacro blocking
|
||||
[& body]
|
||||
`(let [vsm# (-> (current-context)
|
||||
(vu/resolve-system))
|
||||
d# (p/deferred)]
|
||||
(.executeBlocking
|
||||
vsm#
|
||||
(reify Handler
|
||||
(handle [_ prm#]
|
||||
(try
|
||||
(.complete prm# (do ~@body))
|
||||
(catch Throwable e#
|
||||
(.fail prm# e#)))))
|
||||
true
|
||||
(reify Handler
|
||||
(handle [_ ar#]
|
||||
(if (.failed ^AsyncResult ar#)
|
||||
(p/reject! d# (.cause ^AsyncResult ar#))
|
||||
(p/resolve! d# (.result ^AsyncResult ar#))))))
|
||||
d#))
|
||||
|
||||
|
||||
|
||||
|
||||
(defn wrap-blocking
|
||||
([f] (wrap-blocking (current-context) f))
|
||||
([ctx f]
|
||||
|
|
Loading…
Add table
Reference in a new issue