mirror of
https://github.com/penpot/penpot.git
synced 2025-05-11 05:56:37 +02: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]
|
[rows]
|
||||||
(if (empty? rows)
|
(if (empty? rows)
|
||||||
rows
|
rows
|
||||||
(p/all (map populate-thumbnail rows))))
|
(vc/blocking
|
||||||
|
(mapv (fn [row]
|
||||||
|
(images/populate-thumbnail row +thumbnail-options+)) rows))))
|
||||||
|
|
||||||
(defn populate-urls
|
(defn populate-urls
|
||||||
[row]
|
[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))
|
(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
|
(defn wrap-blocking
|
||||||
([f] (wrap-blocking (current-context) f))
|
([f] (wrap-blocking (current-context) f))
|
||||||
([ctx f]
|
([ctx f]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue