mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 03:46:11 +02:00
Merge pull request #6483 from penpot/niwinz-staging-bugfixes-error-report
🐛 Several bugfixes
This commit is contained in:
commit
ff9c8f5929
6 changed files with 47 additions and 44 deletions
|
@ -9,7 +9,6 @@
|
||||||
(:refer-clojure :exclude [tap])
|
(:refer-clojure :exclude [tap])
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.exceptions :as ex]
|
|
||||||
[app.common.logging :as l]
|
[app.common.logging :as l]
|
||||||
[app.common.transit :as t]
|
[app.common.transit :as t]
|
||||||
[app.http.errors :as errors]
|
[app.http.errors :as errors]
|
||||||
|
@ -54,18 +53,20 @@
|
||||||
::yres/status 200
|
::yres/status 200
|
||||||
::yres/body (yres/stream-body
|
::yres/body (yres/stream-body
|
||||||
(fn [_ output]
|
(fn [_ output]
|
||||||
(binding [events/*channel* (sp/chan :buf buf :xf (keep encode))]
|
(let [channel (sp/chan :buf buf :xf (keep encode))
|
||||||
(let [listener (events/start-listener
|
listener (events/start-listener
|
||||||
(partial write! output)
|
channel
|
||||||
(partial pu/close! output))]
|
(partial write! output)
|
||||||
(try
|
(partial pu/close! output))]
|
||||||
|
(try
|
||||||
|
(binding [events/*channel* channel]
|
||||||
(let [result (handler)]
|
(let [result (handler)]
|
||||||
(events/tap :end result))
|
(events/tap :end result)))
|
||||||
(catch Throwable cause
|
|
||||||
(events/tap :error (errors/handle' cause request))
|
(catch Throwable cause
|
||||||
(when-not (ex/instance? java.io.EOFException cause)
|
(let [result (errors/handle' cause request)]
|
||||||
(binding [l/*context* (errors/request->context request)]
|
(events/tap channel :error result)))
|
||||||
(l/err :hint "unexpected error on processing sse response" :cause cause))))
|
|
||||||
(finally
|
(finally
|
||||||
(sp/close! events/*channel*)
|
(sp/close! channel)
|
||||||
(px/await! listener)))))))}))
|
(px/await! listener))))))}))
|
||||||
|
|
|
@ -115,7 +115,8 @@
|
||||||
|
|
||||||
(db/update! pool :project
|
(db/update! pool :project
|
||||||
{:modified-at (dt/now)}
|
{:modified-at (dt/now)}
|
||||||
{:id project-id})
|
{:id project-id}
|
||||||
|
{::db/return-keys false})
|
||||||
|
|
||||||
result))
|
result))
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
to them. Mainly used in http.sse for progress reporting."
|
to them. Mainly used in http.sse for progress reporting."
|
||||||
(:refer-clojure :exclude [tap run!])
|
(:refer-clojure :exclude [tap run!])
|
||||||
(:require
|
(:require
|
||||||
[app.common.data.macros :as dm]
|
|
||||||
[app.common.exceptions :as ex]
|
[app.common.exceptions :as ex]
|
||||||
[app.common.logging :as l]
|
[app.common.logging :as l]
|
||||||
[promesa.exec :as px]
|
[promesa.exec :as px]
|
||||||
|
@ -18,33 +17,30 @@
|
||||||
|
|
||||||
(def ^:dynamic *channel* nil)
|
(def ^:dynamic *channel* nil)
|
||||||
|
|
||||||
(defn channel
|
|
||||||
[]
|
|
||||||
(sp/chan :buf 32))
|
|
||||||
|
|
||||||
(defn tap
|
(defn tap
|
||||||
[type data]
|
([type data]
|
||||||
(when-let [channel *channel*]
|
(when-let [channel *channel*]
|
||||||
(sp/put! channel [type data])
|
(sp/put! channel [type data])
|
||||||
nil))
|
nil))
|
||||||
|
([channel type data]
|
||||||
|
(when channel
|
||||||
|
(sp/put! channel [type data])
|
||||||
|
nil)))
|
||||||
|
|
||||||
(defn start-listener
|
(defn start-listener
|
||||||
[on-event on-close]
|
[channel on-event on-close]
|
||||||
|
(assert (sp/chan? channel) "expected active events channel")
|
||||||
(dm/assert!
|
|
||||||
"expected active events channel"
|
|
||||||
(sp/chan? *channel*))
|
|
||||||
|
|
||||||
(px/thread
|
(px/thread
|
||||||
{:virtual true}
|
{:virtual true}
|
||||||
(try
|
(try
|
||||||
(loop []
|
(loop []
|
||||||
(when-let [event (sp/take! *channel*)]
|
(when-let [event (sp/take! channel)]
|
||||||
(let [result (ex/try! (on-event event))]
|
(let [result (ex/try! (on-event event))]
|
||||||
(if (ex/exception? result)
|
(if (ex/exception? result)
|
||||||
(do
|
(do
|
||||||
(l/wrn :hint "unexpected exception" :cause result)
|
(l/wrn :hint "unexpected exception" :cause result)
|
||||||
(sp/close! *channel*))
|
(sp/close! channel))
|
||||||
(recur)))))
|
(recur)))))
|
||||||
(finally
|
(finally
|
||||||
(on-close)))))
|
(on-close)))))
|
||||||
|
@ -55,7 +51,7 @@
|
||||||
[f on-event]
|
[f on-event]
|
||||||
|
|
||||||
(binding [*channel* (sp/chan :buf 32)]
|
(binding [*channel* (sp/chan :buf 32)]
|
||||||
(let [listener (start-listener on-event (constantly nil))]
|
(let [listener (start-listener *channel* on-event (constantly nil))]
|
||||||
(try
|
(try
|
||||||
(f)
|
(f)
|
||||||
(finally
|
(finally
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
[:map-of {:gen/max 10} ::sm/uuid :map]]
|
[:map-of {:gen/max 10} ::sm/uuid :map]]
|
||||||
[:plugin-data {:optional true} ::ctpg/plugin-data]])
|
[:plugin-data {:optional true} ::ctpg/plugin-data]])
|
||||||
|
|
||||||
(def check-container!
|
(def check-container
|
||||||
(sm/check-fn ::container))
|
(sm/check-fn ::container))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -74,13 +74,9 @@
|
||||||
(defn get-shape
|
(defn get-shape
|
||||||
[container shape-id]
|
[container shape-id]
|
||||||
|
|
||||||
(dm/assert!
|
(assert (check-container container))
|
||||||
"expected valid container"
|
(assert (uuid? shape-id)
|
||||||
(check-container! container))
|
"expected valid uuid for `shape-id`")
|
||||||
|
|
||||||
(dm/assert!
|
|
||||||
"expected valid uuid for `shape-id`"
|
|
||||||
(uuid? shape-id))
|
|
||||||
|
|
||||||
(-> container
|
(-> container
|
||||||
(get :objects)
|
(get :objects)
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
export INCLUDE_STORYBOOK=${BUILD_STORYBOOK:-no};
|
export INCLUDE_STORYBOOK=${BUILD_STORYBOOK:-no};
|
||||||
|
export INCLUDE_WASM=${BUILD_WASM:-yes};
|
||||||
|
|
||||||
export CURRENT_VERSION=$1;
|
export CURRENT_VERSION=$1;
|
||||||
export BUILD_DATE=$(date -R);
|
export BUILD_DATE=$(date -R);
|
||||||
|
@ -17,14 +18,18 @@ export TS=$(date +%s);
|
||||||
export NODE_ENV=production;
|
export NODE_ENV=production;
|
||||||
|
|
||||||
corepack enable;
|
corepack enable;
|
||||||
corepack up || exit 1;
|
corepack install || exit 1;
|
||||||
yarn install || exit 1;
|
yarn install || exit 1;
|
||||||
|
|
||||||
rm -rf resources/public;
|
rm -rf resources/public;
|
||||||
rm -rf target/dist;
|
rm -rf target/dist;
|
||||||
|
|
||||||
yarn run build:app:main --config-merge "{:release-version \"${CURRENT_HASH}-${TS}\"}" $EXTRA_PARAMS || exit 1
|
yarn run build:app:main --config-merge "{:release-version \"${CURRENT_HASH}-${TS}\"}" $EXTRA_PARAMS || exit 1
|
||||||
yarn run build:wasm || exit 1;
|
|
||||||
|
if [ "$INCLUDE_WASM" = "yes" ]; then
|
||||||
|
yarn run build:wasm || exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
yarn run build:app:libs || exit 1;
|
yarn run build:app:libs || exit 1;
|
||||||
yarn run build:app:assets || exit 1;
|
yarn run build:app:assets || exit 1;
|
||||||
|
|
||||||
|
@ -36,7 +41,10 @@ sed -i -re "s/\%version\%/$CURRENT_VERSION/g" ./target/dist/render.html;
|
||||||
sed -i -re "s/\%version\%/$CURRENT_VERSION/g" ./target/dist/rasterizer.html;
|
sed -i -re "s/\%version\%/$CURRENT_VERSION/g" ./target/dist/rasterizer.html;
|
||||||
sed -i -re "s/\%buildDate\%/$BUILD_DATE/g" ./target/dist/index.html;
|
sed -i -re "s/\%buildDate\%/$BUILD_DATE/g" ./target/dist/index.html;
|
||||||
sed -i -re "s/\%buildDate\%/$BUILD_DATE/g" ./target/dist/rasterizer.html;
|
sed -i -re "s/\%buildDate\%/$BUILD_DATE/g" ./target/dist/rasterizer.html;
|
||||||
sed -i "s/version=develop/version=$CURRENT_VERSION/g" ./target/dist/js/render_wasm.js;
|
|
||||||
|
if [ "$INCLUDE_WASM" = "yes" ]; then
|
||||||
|
sed -i "s/version=develop/version=$CURRENT_VERSION/g" ./target/dist/js/render_wasm.js;
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$INCLUDE_STORYBOOK" = "yes" ]; then
|
if [ "$INCLUDE_STORYBOOK" = "yes" ]; then
|
||||||
# build storybook
|
# build storybook
|
||||||
|
|
|
@ -115,6 +115,7 @@ function build {
|
||||||
--mount source=`pwd`,type=bind,target=/home/penpot/penpot \
|
--mount source=`pwd`,type=bind,target=/home/penpot/penpot \
|
||||||
-e EXTERNAL_UID=$CURRENT_USER_ID \
|
-e EXTERNAL_UID=$CURRENT_USER_ID \
|
||||||
-e BUILD_STORYBOOK=$BUILD_STORYBOOK \
|
-e BUILD_STORYBOOK=$BUILD_STORYBOOK \
|
||||||
|
-e BUILD_WASM=$BUILD_WASM \
|
||||||
-e SHADOWCLJS_EXTRA_PARAMS=$SHADOWCLJS_EXTRA_PARAMS \
|
-e SHADOWCLJS_EXTRA_PARAMS=$SHADOWCLJS_EXTRA_PARAMS \
|
||||||
-e JAVA_OPTS="$JAVA_OPTS" \
|
-e JAVA_OPTS="$JAVA_OPTS" \
|
||||||
-w /home/penpot/penpot/$1 \
|
-w /home/penpot/penpot/$1 \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue