From f3346786ea9fc0fc79bd22a3489406a7e7a02afb Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 23 May 2024 15:30:13 +0200 Subject: [PATCH] :fire: Remove unused object-update task --- backend/src/app/main.clj | 5 --- backend/src/app/tasks/object_update.clj | 32 ------------------- .../rpc_file_thumbnails_test.clj | 10 +----- 3 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 backend/src/app/tasks/object_update.clj diff --git a/backend/src/app/main.clj b/backend/src/app/main.clj index 80f0651bf..023783828 100644 --- a/backend/src/app/main.clj +++ b/backend/src/app/main.clj @@ -349,8 +349,6 @@ :audit-log-archive (ig/ref :app.loggers.audit.archive-task/handler) :audit-log-gc (ig/ref :app.loggers.audit.gc-task/handler) - :object-update - (ig/ref :app.tasks.object-update/handler) :delete-object (ig/ref :app.tasks.delete-object/handler) :process-webhook-event @@ -382,9 +380,6 @@ :app.tasks.orphan-teams-gc/handler {::db/pool (ig/ref ::db/pool)} - :app.tasks.object-update/handler - {::db/pool (ig/ref ::db/pool)} - :app.tasks.delete-object/handler {::db/pool (ig/ref ::db/pool)} diff --git a/backend/src/app/tasks/object_update.clj b/backend/src/app/tasks/object_update.clj deleted file mode 100644 index cfe5fda44..000000000 --- a/backend/src/app/tasks/object_update.clj +++ /dev/null @@ -1,32 +0,0 @@ -;; This Source Code Form is subject to the terms of the Mozilla Public -;; License, v. 2.0. If a copy of the MPL was not distributed with this -;; file, You can obtain one at http://mozilla.org/MPL/2.0/. -;; -;; Copyright (c) KALEIDOS INC - -(ns app.tasks.object-update - "A task used for perform simple object properties update - in an asynchronous flow." - (:require - [app.common.data :as d] - [app.common.logging :as l] - [app.db :as db] - [clojure.spec.alpha :as s] - [integrant.core :as ig])) - -(defn- update-object - [{:keys [::db/conn] :as cfg} {:keys [id object key val] :as props}] - (l/trc :hint "update object prop" - :id (str id) - :object (d/name object) - :key (d/name key) - :val val) - (db/update! conn object {key val} {:id id} {::db/return-keys false})) - -(defmethod ig/pre-init-spec ::handler [_] - (s/keys :req [::db/pool])) - -(defmethod ig/init-key ::handler - [_ cfg] - (fn [{:keys [props] :as params}] - (db/tx-run! cfg update-object props))) diff --git a/backend/test/backend_tests/rpc_file_thumbnails_test.clj b/backend/test/backend_tests/rpc_file_thumbnails_test.clj index 11ed4f352..e5cd918b1 100644 --- a/backend/test/backend_tests/rpc_file_thumbnails_test.clj +++ b/backend/test/backend_tests/rpc_file_thumbnails_test.clj @@ -346,13 +346,5 @@ (assoc :size 312043)))) out (th/command! data)] (t/is (nil? (:error out))) - (t/is (map? (:result out)))) + (t/is (map? (:result out)))))) - (let [[row1 :as rows] - (->> (th/db-query :task {:name "object-update"}) - (map #(update % :props db/decode-transit-pgobject)))] - - ;; (app.common.pprint/pprint rows) - (t/is (= 1 (count rows))) - (t/is (> (inst-ms (dt/diff (:created-at row1) (:scheduled-at row1))) - (inst-ms (dt/duration "4m")))))))