mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 02:28:18 -05:00
🔥 Remove unnecessary async touch operation
This commit is contained in:
parent
584a0fdba1
commit
d241f45253
2 changed files with 7 additions and 20 deletions
|
@ -271,7 +271,7 @@
|
||||||
(when (and (some? th1)
|
(when (and (some? th1)
|
||||||
(not= (:media-id th1)
|
(not= (:media-id th1)
|
||||||
(:media-id th2)))
|
(:media-id th2)))
|
||||||
(sto/touch-object! storage (:media-id th1) :async true))
|
(sto/touch-object! storage (:media-id th1)))
|
||||||
|
|
||||||
th2))
|
th2))
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
[app.storage.impl :as impl]
|
[app.storage.impl :as impl]
|
||||||
[app.storage.s3 :as ss3]
|
[app.storage.s3 :as ss3]
|
||||||
[app.util.time :as dt]
|
[app.util.time :as dt]
|
||||||
[app.worker :as wrk]
|
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[datoteka.fs :as fs]
|
[datoteka.fs :as fs]
|
||||||
[integrant.core :as ig]
|
[integrant.core :as ig]
|
||||||
|
@ -171,28 +170,16 @@
|
||||||
(impl/put-object object content))
|
(impl/put-object object content))
|
||||||
object)))
|
object)))
|
||||||
|
|
||||||
(def ^:private default-touch-delay
|
|
||||||
"A default delay for the asynchronous touch operation"
|
|
||||||
(dt/duration "5m"))
|
|
||||||
|
|
||||||
(defn touch-object!
|
(defn touch-object!
|
||||||
"Mark object as touched."
|
"Mark object as touched."
|
||||||
[{:keys [::db/pool-or-conn] :as storage} object-or-id & {:keys [async]}]
|
[{:keys [::db/pool-or-conn] :as storage} object-or-id]
|
||||||
(us/assert! ::storage storage)
|
(us/assert! ::storage storage)
|
||||||
(let [id (if (impl/object? object-or-id) (:id object-or-id) object-or-id)]
|
(let [id (if (impl/object? object-or-id) (:id object-or-id) object-or-id)]
|
||||||
(if async
|
|
||||||
(wrk/submit! ::wrk/conn pool-or-conn
|
|
||||||
::wrk/task :object-update
|
|
||||||
::wrk/delay default-touch-delay
|
|
||||||
:object :storage-object
|
|
||||||
:id id
|
|
||||||
:key :touched-at
|
|
||||||
:val (dt/now))
|
|
||||||
(-> (db/update! pool-or-conn :storage-object
|
(-> (db/update! pool-or-conn :storage-object
|
||||||
{:touched-at (dt/now)}
|
{:touched-at (dt/now)}
|
||||||
{:id id})
|
{:id id})
|
||||||
(db/get-update-count)
|
(db/get-update-count)
|
||||||
(pos?)))))
|
(pos?))))
|
||||||
|
|
||||||
(defn get-object-data
|
(defn get-object-data
|
||||||
"Return an input stream instance of the object content."
|
"Return an input stream instance of the object content."
|
||||||
|
|
Loading…
Add table
Reference in a new issue