mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 05:50:35 +00:00
🔧 Fix dashboard thumbnails crashing on deployed environments (#12465)
* 🐛 Pass version tag to worker so it loads the current render wasm * 🐛 Keep wasm thumbnail queue alive when one render fails * 🐛 Fail wasm thumbnail request when canvas context cannot init
This commit is contained in:
parent
05e1981acc
commit
452d751dff
@ -22,7 +22,8 @@
|
||||
(uw/ask! worker {:cmd :configure
|
||||
:config {:public-uri cf/public-uri
|
||||
:build-data cf/build-date
|
||||
:version cf/version}})
|
||||
:version cf/version
|
||||
:version-tag cf/version-tag}})
|
||||
(set! instance worker)))
|
||||
|
||||
(defn ask!
|
||||
|
||||
@ -36,6 +36,9 @@
|
||||
(when-let [version (get config :version)]
|
||||
(set! cf/version version))
|
||||
|
||||
(when-let [version-tag (get config :version-tag)]
|
||||
(set! cf/version-tag version-tag))
|
||||
|
||||
(when-let [build-date (get config :build-data)]
|
||||
(set! cf/build-date build-date))
|
||||
|
||||
|
||||
@ -192,7 +192,7 @@
|
||||
:file-id file-id
|
||||
:revn revn}))
|
||||
(rx/end! subs)))))))
|
||||
(rx/end! subs))
|
||||
(rx/error! subs (ex-info "unable to init wasm canvas" {:file-id file-id})))
|
||||
nil)))))))
|
||||
|
||||
(defonce ^:private
|
||||
@ -202,7 +202,10 @@
|
||||
(defonce ^:private
|
||||
thumbnails-stream
|
||||
(->> thumbnails-queue
|
||||
(rx/mapcat render-thumbnail-with-wasm)
|
||||
(rx/mapcat (fn [{:keys [id] :as message}]
|
||||
(->> (render-thumbnail-with-wasm message)
|
||||
(rx/catch (fn [cause]
|
||||
(rx/of {:id id :error cause}))))))
|
||||
(rx/share)))
|
||||
|
||||
(defmethod impl/handler :thumbnails/generate-for-file-wasm
|
||||
@ -213,8 +216,10 @@
|
||||
sid (->> thumbnails-stream
|
||||
(rx/filter #(= id (:id %)))
|
||||
(rx/subs!
|
||||
(fn [result]
|
||||
(rx/push! subs result)
|
||||
(rx/end! subs))))]
|
||||
(fn [{:keys [error] :as result}]
|
||||
(if error
|
||||
(rx/error! subs error)
|
||||
(do (rx/push! subs result)
|
||||
(rx/end! subs))))))]
|
||||
(rx/push! thumbnails-queue (assoc message :id id))
|
||||
#(rx/dispose! sid)))))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user