enhance(asset-sync): compare local asset-file metadata when generating ops

This commit is contained in:
rcmerci
2024-11-21 18:39:25 +08:00
committed by Tienson Qin
parent 6eb94925a8
commit 6d9da5713d
3 changed files with 37 additions and 23 deletions

View File

@@ -217,7 +217,7 @@
[]
(when-let [path (config/get-current-repo-assets-root)]
(p/let [result (p/catch (fs/readdir path {:path-only? true})
(fn [_e] nil))]
(constantly nil))]
(p/all (map (fn [path]
(p/let [data (fs/read-file path "" {})]
(let [path' (util/node-path.join "assets" (util/node-path.basename path))]
@@ -240,7 +240,7 @@
[repo]
(when-let [path (config/get-repo-assets-root repo)]
(p/catch (fs/readdir path {:path-only? true})
(fn [_e] nil))))
(constantly nil))))
(defn <read-asset
[repo asset-block-id asset-type]
@@ -255,7 +255,7 @@
blob (js/Blob. (array file) (clj->js {:type "image"}))
checksum (get-file-checksum blob)]
{:checksum checksum})
(p/catch (fn [_e] nil))))
(p/catch (constantly nil))))
(defn <write-asset
[repo asset-block-id asset-type data]